Re: [PATCH] net: dsa: return success if there was nothing to do

From: Vladimir Oltean
Date: Sat Mar 05 2022 - 15:33:09 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: Vladimir Oltean <olteanv@xxxxxxxxx>