Author: Julia Lawall <Julia.Lawall@lip6.fr> Delete successive tests to the same location. There was a previous test on ret and it has not been updated since then. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @s exists@ local idexpression y; expression x,e; @@ *if ( \(x == NULL\|IS_ERR(x)\|y …
Category: Linux
Jan 21 2013
drivers/usb/chipidea/core.c: adjust duplicate test
Author: Julia Lawall <Julia.Lawall@lip6.fr> Delete successive tests to the same location. In this case res has already been tested for being NULL, and calling devm_request_and_ioremap will not make it NULL. On the other hand, devm_request_and_ioremap can return NULL on failure. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) …
Jan 21 2013
drivers/net/ethernet/sfc/ptp.c: adjust duplicate test
Author: Julia Lawall <Julia.Lawall@lip6.fr> Delete successive tests to the same location. rc was previously tested and not subsequently updated. efx_phc_adjtime can return an error code, so the call is updated so that is tested instead. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @s exists@ local idexpression …
Jan 09 2013
spi: Add helper functions for setting up transfers
Author: Lars-Peter Clausen <lars@metafoo.de> Quite often the pattern used for setting up and transferring a synchronous SPI transaction looks very much like the following: struct spi_message msg; struct spi_transfer xfers[] = { … }; spi_message_init(&msg); spi_message_add_tail(&xfers[0], &msg); … spi_message_add_tail(&xfers[ARRAY_SIZE(xfers) – 1], &msg); ret = spi_sync(&msg); This patch adds two new helper functions for handling this …
Jan 08 2013
i2c: muxes: fix wrong use of sizeof(ptr)
Author: Laurent Navet <laurent.navet@gmail.com> sizeof when applied to a pointer typed expression gives the size of the pointer The semantic patch that makes this output is available in scripts/coccinelle/misc/noderef.cocci. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Laurent Navet Acked-by: Jean Delvare Signed-off-by: Wolfram Sang — drivers/i2c/muxes/i2c-mux-pinctrl.c | 2 +- 1 file changed, …
Jan 07 2013
crypto: bfin_crc – reposition free_irq to avoid access to invalid data
Author: Julia Lawall <Julia.Lawall@lip6.fr> The data referenced by an interrupt handler should not be freed before the interrupt is ended. The handler is bfin_crypto_crc_handler. It may refer to crc->regs, which is released by the iounmap. Furthermore, the second argument to all calls to free_irq is incorrect. It should be the same as the last argument …
Jan 06 2013
88pm860x_battery: Eliminate possible references to released resources
Author: Julia Lawall <julia.lawall@lip6.fr> devm_kzalloc should not be followed by kfree, as this results in a double free. The problem was found using the following semantic match (http://coccinelle.lip6.fr/): // @@ expression x,e; @@ x = devm_kzalloc(…) … when != x = e ?-kfree(x,…); // Furthermore, in the remove function, the calls to free_irq are moved …
Jan 03 2013
MIPS: Loongson2: Use clk API instead of direct dereferences
Author: Julia Lawall <Julia.Lawall@lip6.fr> A struct clk value is intended to be an abstract pointer, so it should be manipulated using the various API functions. clk_put is additionally added on the failure paths. The semantic match that finds the first problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e,e1; identifier i; @@ *e = clk_get(…) …
Dec 22 2012
[SCSI] bnx2fc: Remove potential NULL dereference
Author: Julia Lawall <Julia.Lawall@lip6.fr> If the NULL test is necessary, the initialization involving a dereference of the tested value should be moved after the NULL test. The sematic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ type T; expression E; identifier i,fld; statement S; @@ – T i = E->fld; + T …
Dec 16 2012
arch/arm/mach-omap2/dpll3xxx.c: drop if around WARN_ON
Author: Julia Lawall <Julia.Lawall@lip6.fr> Just use WARN_ON rather than an if containing only WARN_ON(1). A simplified version of the semantic patch that makes this transformation is as follows: (http://coccinelle.lip6.fr/) // @@ expression e; @@ – if (e) WARN_ON(1); + WARN_ON(e); // Signed-off-by: Julia Lawall Signed-off-by: Tony Lindgren — arch/arm/mach-omap2/dpll3xxx.c | 3 +– 1 file changed, …