Re: [PATCH] niu: Fix missing unwind goto in niu_alloc_channels()

From: Simon Horman
Date: Thu Apr 06 2023 - 10:31:15 EST


On Wed, Apr 05, 2023 at 11:31:18PM -0700, Harshit Mogalapalli wrote:
> 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@xxxxxxxxxx>
> ---
> This is purely based on static analysis. Only compile tested.

Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>