Re: [PATCH] net: dsa: return success if there was nothing to do
From: Andrew Lunn
Date: Sat Mar 05 2022 - 14:11:25 EST
On Sat, Mar 05, 2022 at 09:14:48AM -0800, trix@xxxxxxxxxx wrote:
> From: Tom Rix <trix@xxxxxxxxxx>
>
> Clang static analysis reports this representative issue
> dsa.c:486:2: warning: Undefined or garbage value
> returned to caller
> return err;
> ^~~~~~~~~~
>
> err is only set in the loop. If the loop is empty,
> garbage will be returned. So initialize err to 0
> to handle this noop case.
>
> Signed-off-by: Tom Rix <trix@xxxxxxxxxx>
Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
Andrew