drivers/net/wireless/mwifiex/scan.c: test the just-initialized value

Author: Julia Lawall <julia@diku.dk> Test the just-initialized value rather than some other one. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST}; statement S; @@ x = f(…); ( if (\(x == NULL\|IS_ERR(x)\)) S | *if (\(y == NULL\|IS_ERR(y)\)) { … when != x return …; } ) // …

Lire la suite

drivers/usb/host/ohci-omap3.c: test the just-initialized value

Author: Julia Lawall <julia@diku.dk> Test the just-initialized value rather than some other one. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST}; statement S; @@ x = f(…); ( if (\(x == NULL\|IS_ERR(x)\)) S | *if (\(y == NULL\|IS_ERR(y)\)) { … when != x return …; } ) // …

Lire la suite

drivers/staging/usbip/userspace/libsrc/vhci_driver.c: test the just-initialized value

Author: Julia Lawall <julia@diku.dk> Test the just-initialized value rather than some other one. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST}; statement S; @@ x = f(…); ( if (\(x == NULL\|IS_ERR(x)\)) S | *if (\(y == NULL\|IS_ERR(y)\)) { … when != x return …; } ) // …

Lire la suite

sound/soc/mxs/mxs-saif.c: add missing kfree

Author: Julia Lawall <julia@diku.dk> Move the test on pdev->id before the kzalloc to avoid requiring kfree when the test fails. This fix was suggested by Wolfram Sang. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; expression E1!=0,E2,E3,E4; statement S; iterator I; @@ ( if …

Lire la suite

powerpc/powermac: Add missing of_node_put

Author: Julia Lawall <julia@diku.dk> np is initialized to the result of calling a function that calls of_node_get, so of_node_put should be called before the pointer is dropped. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e,e1,e2; @@ * e = \(of_find_node_by_type\|of_find_node_by_name\)(…) … when != of_node_put(e) when != true e …

Lire la suite

powerpc/cell/iommu: Add missing of_node_put

Author: Julia Lawall <julia@diku.dk> np is initialized to the result of calling a function that calls of_node_get, so of_node_put should be called before the pointer is dropped. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e,e1,e2; @@ * e = \(of_find_node_by_type\|of_find_node_by_name\)(…) … when != of_node_put(e) when != true e …

Lire la suite

sound/soc/fsl/mpc8610_hpcd.c: add missing of_node_put

Author: Julia Lawall <julia@diku.dk> The first change is to add an of_node_put, since codec_np has previously been allocated. The rest of the patch reorganizes the error handling code so the only code executed is that which is needed. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ …

Lire la suite

sound/soc/fsl/p1022_ds.c: add missing of_node_put

Author: Julia Lawall <julia@diku.dk> dma_channel_np has been accessed at this point, so decrease its reference count before leaving the function. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; expression E1!=0,E2,E3,E4; statement S; iterator I; @@ ( if (…) { … when != of_node_put(x) when …

Lire la suite

ALSA: sound/aoa/fabrics/layout.c: remove unneeded kfree

Author: Julia Lawall <julia@diku.dk> The label outnodev is only used when kzalloc has not yet taken place or has failed, so there is no need for the call for kfree under this label. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; expression E1!=0,E2,E3,E4; statement …

Lire la suite

sound/soc/ep93xx/ep93xx-i2s.c: add missing kfree

Author: Julia Lawall <julia@diku.dk> Introduce a new label that includes kfree and jump to that one. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; expression E1!=0,E2,E3,E4; statement S; iterator I; @@ ( if (…) { … when != kfree(x) when != x = E3 …

Lire la suite