Thread (2 messages) 2 messages, 2 authors, 2007-11-28
STALE6762d

[PATCH 4/5] drivers/pnp/resource.c: Add missing pci_dev_put

From: Julia Lawall <hidden>
Date: 2007-11-19 08:07:34
Also in: lkml

From: Julia Lawall <redacted>

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 <redacted>
---

diff -u -p a/drivers/pnp/resource.c b/drivers/pnp/resource.c
--- a/drivers/pnp/resource.c    2007-10-22 11:25:20.000000000 +0200
+++ b/drivers/pnp/resource.c    2007-11-19 08:18:44.000000000 +0100
@@ -367,8 +367,10 @@ int pnp_check_irq(struct pnp_dev *dev, i
         {
                 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help