]> git.karo-electronics.de Git - karo-tx-linux.git/commit
drivers/net/wireless/p54/eeprom.c: Return -ENOMEM on memory allocation failure
authorJulia Lawall <julia@diku.dk>
Fri, 15 Oct 2010 13:00:06 +0000 (15:00 +0200)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Thu, 6 Jan 2011 23:08:23 +0000 (18:08 -0500)
commit2d29e2c584ec9784b186324485143d5dfa2c0212
treef188b1dfaf7af032c9929af3e5ac6e6a4ca36412
parentc0d545fa659292441d34062fc797e685bb9952bf
drivers/net/wireless/p54/eeprom.c: Return -ENOMEM on memory allocation failure

commit 0d91f22b75347d9503b17a42b6c74d3f7750acd6 upstream.

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/)

// <smpl>
@@
expression ret;
expression x,e1,e2,e3;
@@

ret = 0
... when != ret = e1
*x = \(kmalloc\|kcalloc\|kzalloc\)(...)
... when != ret = e2
if (x == NULL) { ... when != ret = e3
  return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
drivers/net/wireless/p54/eeprom.c