An error occurred while fetching folder content.
net: cavium: liquidio: Return correct error code
Amitoj Kaur Chawla authored

The return value of vmalloc 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;
identifier l1;
position p,q;
@@

e@q = vmalloc(...);
if@p (e == NULL) {
...
goto l1;
}
l1:
...
return -1
+ -ENOMEM
;
//</smpl

The single call site of the containing function checks whether the
returned value is -1, so this check is changed as well. The single call
site of this call site, however, only checks whether the value is not 0,
so no further change was required.
Signed-off-by: default avatarAmitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
(cherry picked from linux-next commit 08a965ec

)
Signed-off-by: default avatarDann Frazier <dann.frazier@canonical.com>
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
ed7cc20b
Name Last commit Last update