summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>2016-02-07 06:26:25 +0100
committerDavid S. Miller <davem@davemloft.net>2016-02-11 15:43:25 +0100
commit6d9b6f424d0806e2a7f3e7f0a74170ec3ad30443 (patch)
tree956d44bbd4de64d416c98df2bc33a8b536ed8aa9 /drivers/net/bonding
parentMerge branch 'gso-checksums' (diff)
downloadlinux-6d9b6f424d0806e2a7f3e7f0a74170ec3ad30443.tar.xz
linux-6d9b6f424d0806e2a7f3e7f0a74170ec3ad30443.zip
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>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_alb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index bb9e9fc45e1b..c5ac160a8ae9 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -159,7 +159,7 @@ static int tlb_initialize(struct bonding *bond)
new_hashtbl = kzalloc(size, GFP_KERNEL);
if (!new_hashtbl)
- return -1;
+ return -ENOMEM;
spin_lock_bh(&bond->mode_lock);