From: Julia Lawall Date: Wed, 6 Feb 2008 09:39:23 +0000 (-0800) Subject: drivers/video: add missing pci_dev_get X-Git-Tag: v2.6.25-rc1~580 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=625fcaf97340b9409e41fcefbbd18e02e3a9e9dd;p=pandora-kernel.git drivers/video: add missing pci_dev_get pci_get_device does a pci_dev_get, so pci_dev_put needs to be called in an error case The problem was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // @exists@ type T1,T2; identifier E; statement S,S1; expression x1,x2,x3; expression test; int ret != 0; @@ struct pci_dev *E; ... ( E = \(pci_get_slot\|pci_get_device\|pci_get_bus_and_slot\)(...); if (E == NULL) S | if ((E = \(pci_get_slot\|pci_get_device\|pci_get_bus_and_slot\)(...)) == NULL) S ) ... when != pci_dev_put(...,(T1)E,...) when != if (E != NULL) { ... pci_dev_put(...,(T1)E,...); ...} when != x1 = (T1)E when != E = x3; when any ( if (E == NULL) S1 | if (test) + { ( + pci_dev_put(E); return; | + pci_dev_put(E); return ret; ) + } | if (test) { ... when != pci_dev_put(...,(T2)E,...) when != if (E != NULL) { ... pci_dev_put(...,(T2)E,...); ...} when != x2 = (T2)E ( + pci_dev_put(E); return; | + pci_dev_put(E); return ret; ) } ) // Signed-off-by: Julia Lawall Cc: "David S. Miller" Cc: "Antonino A. Daplas" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed