Re: [PATCH] net: sky2: initialize return of gm_phy_read
From: Andrew Lunn
Date: Fri Jul 03 2020 - 09:53:22 EST
On Fri, Jul 03, 2020 at 06:33:59AM -0700, trix@xxxxxxxxxx wrote:
> From: Tom Rix <trix@xxxxxxxxxx>
>
> clang static analysis flags this garbage return
>
> drivers/net/ethernet/marvell/sky2.c:208:2: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn]
> return v;
> ^~~~~~~~
>
> static inline u16 gm_phy_read( ...
> {
> u16 v;
> __gm_phy_read(hw, port, reg, &v);
> return v;
> }
>
> __gm_phy_read can return without setting v.
>
> So handle similar to skge.c's gm_phy_read, initialize v.
>
> Signed-off-by: Tom Rix <trix@xxxxxxxxxx>
Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
Andrew