Patchwork [3/6] PCI: Fix __must_check annotation on pci_create_sysfs_dev_files()

login
register
mail settings
Submitter Bjorn Helgaas
Date April 12, 2013, 8:48 p.m.
Message ID <20130412204800.5237.60312.stgit@bhelgaas-glaptop>
Download mbox | patch
Permalink /patch/236191/
State Accepted
Headers show

Comments

Bjorn Helgaas - April 12, 2013, 8:48 p.m.
The __must_check (gcc "warn_unused_result") attribute only makes sense
when compiling the *caller* of the function, so the annotation of the
pci_create_sysfs_dev_files() definition did nothing.

This moves the annotation to the declaration and fixes the resulting
warning.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/bus.c       |    4 +++-
 drivers/pci/pci-sysfs.c |    2 +-
 drivers/pci/pci.h       |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 8647dc6..e54ddb5 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -174,7 +174,9 @@  int pci_bus_add_device(struct pci_dev *dev)
 	 * Can not put in pci_device_add yet because resources
 	 * are not assigned yet for some devices.
 	 */
-	pci_create_sysfs_dev_files(dev);
+	retval = pci_create_sysfs_dev_files(dev);
+	if (retval)
+		return retval;
 
 	dev->match_driver = true;
 	retval = device_attach(&dev->dev);
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 9c6e9bb..aa551e2 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1299,7 +1299,7 @@  error:
 	return retval;
 }
 
-int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
+int pci_create_sysfs_dev_files (struct pci_dev *pdev)
 {
 	int retval;
 	int rom_size = 0;
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 7346ee6..91b9ce6 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -8,7 +8,7 @@ 
 
 /* Functions internal to the PCI core code */
 
-extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);
+extern int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev);
 extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
 #if !defined(CONFIG_DMI) && !defined(CONFIG_ACPI)
 static inline void pci_create_firmware_label_files(struct pci_dev *pdev)