]> git.baikalelectronics.ru Git - kernel.git/commit
bonding: Return correct error code
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Sun, 7 Feb 2016 05:26:25 +0000 (10:56 +0530)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Feb 2016 14:43:25 +0000 (09:43 -0500)
commit3f2b471681425b49bc5380f123104e86f698324b
tree956d44bbd4de64d416c98df2bc33a8b536ed8aa9
parentcd5a5a8bc9ec5af387098cbe355dd37242bb6054
bonding: Return correct error code

The return value of 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 = kzalloc(...);
if (e == NULL) {
...
return
- -1
+ -ENOMEM
;
}
//</smpl>

The single call site only checks that the return value is not 0,
hence no change is required at the call site.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_alb.c