OSDN Git Service

staging: goldfish: goldfish_nand: Return correct error code
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Fri, 12 Feb 2016 08:39:49 +0000 (14:09 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Feb 2016 00:52:53 +0000 (16:52 -0800)
commit814625b539d36d57cb06f412714ec31d7fcd23db
treeb8858b8277599cd1bc0f978e1d76c2158ce08a3e
parentc272dc2da14cde0bfd9495a5aafb8e3e94f35601
staging: goldfish: goldfish_nand: Return correct error code

The return value of devm_kzalloc on failure of allocation of memory should
be -ENOMEM and not -1.

Found using Coccinelle. A simplified version of the semantic patch
used is:

//<smpl>
@@
expression *e;
@@

e = devm_kzalloc(...);
if (e == NULL) {
...
return
- -1
+ -ENOMEM
;
}
//</smpl>

The single call site does not perform any checks on the return value, hence
no change is required at the call site.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/goldfish/goldfish_nand.c