Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=151fc5dfc87964e85a1cbbb9cc2c0703c017c2ed
Commit:     151fc5dfc87964e85a1cbbb9cc2c0703c017c2ed
Parent:     bf164410d08dc83df416e3a6a43ab29bf88890ed
Author:     Julia Lawall <[EMAIL PROTECTED]>
AuthorDate: Tue Nov 20 08:41:16 2007 +0100
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed Nov 28 14:35:26 2007 -0800

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/pci/pci-sysfs.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 1b7b281..7d18773 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -702,8 +702,10 @@ static int __init pci_sysfs_init(void)
        sysfs_initialized = 1;
        for_each_pci_dev(pdev) {
                retval = pci_create_sysfs_dev_files(pdev);
-               if (retval)
+               if (retval) {
+                       pci_dev_put(pdev);
                        return retval;
+               }
        }
 
        return 0;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to