Skip to content

Commit

Permalink
niu: Fix missing unwind goto in niu_alloc_channels()
Browse files Browse the repository at this point in the history
[ Upstream commit 8ce07be ]

Smatch reports: drivers/net/ethernet/sun/niu.c:4525
	niu_alloc_channels() warn: missing unwind goto?

If niu_rbr_fill() fails, then we are directly returning 'err' without
freeing the channels.

Fix this by changing direct return to a goto 'out_err'.

Fixes: a3138df ("[NIU]: Add Sun Neptune ethernet driver.")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
harshimogalapalli authored and Sasha Levin committed Apr 20, 2023
1 parent b68412c commit 3d47f5a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/sun/niu.c
Original file line number Diff line number Diff line change
Expand Up @@ -4522,7 +4522,7 @@ static int niu_alloc_channels(struct niu *np)

err = niu_rbr_fill(np, rp, GFP_KERNEL);
if (err)
return err;
goto out_err;
}

tx_rings = kcalloc(num_tx_rings, sizeof(struct tx_ring_info),
Expand Down

0 comments on commit 3d47f5a

Please sign in to comment.