diff options
author | Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> | 2023-04-05 23:31:18 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-04-07 08:17:54 +0100 |
commit | 8ce07be703456acb00e83d99f3b8036252c33b02 (patch) | |
tree | 48e980e01004b757428635cd325cdd826e3daab2 | |
parent | f2afccfefe7be1f7346564fe619277110d341f9b (diff) | |
download | lwn-8ce07be703456acb00e83d99f3b8036252c33b02.tar.gz lwn-8ce07be703456acb00e83d99f3b8036252c33b02.zip |
niu: Fix missing unwind goto in niu_alloc_channels()
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: a3138df9f20e ("[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>
-rw-r--r-- | drivers/net/ethernet/sun/niu.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index ab8b09a9ef61..7a2e76776297 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c @@ -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), |