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 <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
harshimogalapalli authored and Sasha Levin committed Apr 19, 2023
1 parent df0c80b commit ee62171
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 @@ -4503,7 +4503,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 ee62171

Please sign in to comment.