Commit 8ea50a3f authored by Julia Lawall's avatar Julia Lawall Committed by Linus Torvalds

drivers/pnp/resource.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: default avatarJulia Lawall <julia@diku.dk>
Cc: Greg KH <greg@kroah.com>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b64d7082
...@@ -367,10 +367,12 @@ int pnp_check_irq(struct pnp_dev *dev, int idx) ...@@ -367,10 +367,12 @@ int pnp_check_irq(struct pnp_dev *dev, int idx)
{ {
struct pci_dev *pci = NULL; struct pci_dev *pci = NULL;
for_each_pci_dev(pci) { for_each_pci_dev(pci) {
if (pci->irq == *irq) if (pci->irq == *irq) {
pci_dev_put(pci);
return 0; return 0;
} }
} }
}
#endif #endif
/* check if the resource is already in use, skip if the /* check if the resource is already in use, skip if the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment