提交 8ea50a3f 编写于 作者: J Julia Lawall 提交者: 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: NJulia Lawall <julia@diku.dk>
Cc: Greg KH <greg@kroah.com>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 b64d7082
...@@ -367,8 +367,10 @@ int pnp_check_irq(struct pnp_dev *dev, int idx) ...@@ -367,8 +367,10 @@ 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册