staging: tidspbridge: Clean up error-handling code

Author: Julia Lawall <julia@diku.dk> In the first hunk, 0 is returned on memory allocation failure, even though other failures return -ENOMEM or other similar values. In the second hunk, there was error handling code that returned without freeing psz_path_name. A simplified version of the semantic match that finds the first problem is as follows: (http://coccinelle.lip6.fr/) …

Lire la suite

SERIAL: ioc3_serial: Return -ENOMEM on memory allocation failure

Author: Julia Lawall <julia@diku.dk> In this code, 0 is returned on memory allocation failure, even though other failures return -ENOMEM or other similar values. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression ret; expression x,e1,e2,e3; @@ ret = 0 … when != ret = e1 …

Lire la suite

drivers/net/wireless/p54/eeprom.c: Return -ENOMEM on memory allocation failure

Author: Julia Lawall <julia@diku.dk> In this code, 0 is returned on memory allocation failure, even though other failures return -ENOMEM or other similar values. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression ret; expression x,e1,e2,e3; @@ ret = 0 … when != ret = e1 …

Lire la suite

drivers/gpu/drm/i915/i915_gem.c: Add missing error handling code

Author: Julia Lawall <julia@diku.dk> Extend the error handling code with operations found in other nearby error handling code A simplified version of the sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r exists@ @r@ statement S1,S2,S3; constant C1,C2,C3; @@ *if (…) {… S1 return -C1;} … *if (…) {… when != S1 …

Lire la suite

[media] drivers/media/dvb/ttpci/av7110_av.c: Add missing error handling code

Author: Julia Lawall <julia@diku.dk> Extend the error handling code with operations found in other nearby error handling code. A simplified version of the sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r exists@ @r@ statement S1,S2,S3; constant C1,C2,C3; @@ *if (…) {… S1 return -C1;} … *if (…) {… when != S1 …

Lire la suite

drivers/atm/idt77252.c: Remove unnecessary error check

Author: Julia Lawall <julia@diku.dk> This code does not call deinit_card(card); in an error case, as done in other error-handling code in the same function. But actually, the called function init_sram can only return 0, so there is no need for the error check at all. init_sram is also given a void return type, and its …

Lire la suite

spi/amba-pl022: Fix error case return statement.

Author: Julia Lawall <julia@diku.dk> The return -EINVAL appears to only make sense if the if branch that it is aligned with is taken, and the indentation indicates that this is the authors intent, so move it into that branch. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r disable braces4@ position …

Lire la suite

spi/orion: Drop unnecessary null test

Author: Julia Lawall <julia@diku.dk> list_for_each_entry binds its first argument to a non-null value, and thus any null test on the value of that argument is superfluous. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ iterator I; expression x,E; @@ I(x,…) { } // Signed-off-by: Julia Lawall Signed-off-by: Grant Likely — …

Lire la suite

staging: wlags49_h2: use free_netdev(netdev) instead of kfree()

Author: Vasiliy Kulikov <segooon@gmail.com> Freeing netdev without free_netdev() leads to net, tx leaks. I might lead to dereferencing freed pointer. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) @@ struct net_device* dev; @@ -kfree(dev) +free_netdev(dev) Signed-off-by: Vasiliy Kulikov Signed-off-by: Greg Kroah-Hartman — drivers/staging/wlags49_h2/wl_netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 …

Lire la suite

staging: slicoss: use free_netdev(netdev) instead of kfree()

Author: Vasiliy Kulikov <segooon@gmail.com> Freeing netdev without free_netdev() leads to net, tx leaks. I might lead to dereferencing freed pointer. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) @@ struct net_device* dev; @@ -kfree(dev) +free_netdev(dev) Signed-off-by: Vasiliy Kulikov Acked-by: Denis Kirjanov Signed-off-by: Greg Kroah-Hartman — drivers/staging/slicoss/slicoss.c | 2 +- 1 file changed, …

Lire la suite