]> 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)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 22 Nov 2010 19:03:07 +0000 (11:03 -0800)
commit93f985f2dc6557db80e27f366ec34c8ba77bf859
tree12ecd614a9ff49f7a7bb2c0cc1494d7670729f27
parent3220931050ed5e936b215b37d20ddf6424bcca07
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: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/wireless/p54/eeprom.c