Messages in this thread Patch in this message | | | Date | Mon, 19 Nov 2007 09:07:22 +0100 (CET) | From | Julia Lawall <> | Subject | [PATCH 4/5] drivers/pnp/resource.c: Add missing pci_dev_put |
| |
From: Julia Lawall <julia@diku.dk>
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> ---
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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |