]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
drivers/pnp/resource.c: Add missing pci_dev_put
authorJulia Lawall <julia@diku.dk>
Thu, 29 Nov 2007 00:21:36 +0000 (16:21 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 29 Nov 2007 17:24:52 +0000 (09:24 -0800)
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>
Cc: Greg KH <greg@kroah.com>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/pnp/resource.c

index 41d73a5e9312f16d87f751f2116036d11b8bef7c..e50ebcffb96240937e3f43f4474857f6cdee8030 100644 (file)
@@ -367,8 +367,10 @@ int pnp_check_irq(struct pnp_dev *dev, int idx)
        {
                struct pci_dev *pci = NULL;
                for_each_pci_dev(pci) {
-                       if (pci->irq == *irq)
+                       if (pci->irq == *irq) {
+                               pci_dev_put(pci);
                                return 0;
+                       }
                }
        }
 #endif