aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2007-11-20 02:41:16 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-11-28 17:35:26 -0500
commit151fc5dfc87964e85a1cbbb9cc2c0703c017c2ed (patch)
tree3c5bf6adaee5a5c3545071de5154c6e43b6bb901 /drivers/pci
parentbf164410d08dc83df416e3a6a43ab29bf88890ed (diff)
PCI: drivers/pci/pci-sysfs.c: Add missing pci_dev_put
There should be a pci_dev_put when breaking out of a loop that iterates over calls to pci_get_device and similar functions. This was fixed using the following semantic patch. // <smpl> @@ identifier d; type T; expression e; iterator for_each_pci_dev; @@ T *d; ... for_each_pci_dev(d) {... when != pci_dev_put(d) when != e = d ( return d; | + pci_dev_put(d); ? return ...; ) ...} // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-sysfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 1b7b2812bf2d..7d1877341aad 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -702,8 +702,10 @@ static int __init pci_sysfs_init(void)
702 sysfs_initialized = 1; 702 sysfs_initialized = 1;
703 for_each_pci_dev(pdev) { 703 for_each_pci_dev(pdev) {
704 retval = pci_create_sysfs_dev_files(pdev); 704 retval = pci_create_sysfs_dev_files(pdev);
705 if (retval) 705 if (retval) {
706 pci_dev_put(pdev);
706 return retval; 707 return retval;
708 }
707 } 709 }
708 710
709 return 0; 711 return 0;