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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 drivers/pci/bus.c       |    4 +++-
 drivers/pci/pci-sysfs.c |    2 +-
 drivers/pci/pci.h       |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

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)

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




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux