[U-Boot] [PATCH] net: zynq_gem: Initialize val variable in zynq_gem_miiphy_read()

Joe Hershberger joe.hershberger at ni.com
Thu Jun 14 17:35:52 UTC 2018


On Thu, Jun 14, 2018 at 2:08 AM, Michal Simek <michal.simek at xilinx.com> wrote:
> phyread can timeout and val will contain random value. Initialize it to
> zero not to report random value in case of error.
>
> Signed-off-by: Michal Simek <michal.simek at xilinx.com>

Acked-by: Joe Hershberger <joe.hershberger at ni.com>

> ---
>
> Reported by: Coverity (local)
>
> ---
>  drivers/net/zynq_gem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
> index a817f2e5d69b..d1138fe0903d 100644
> --- a/drivers/net/zynq_gem.c
> +++ b/drivers/net/zynq_gem.c
> @@ -609,7 +609,7 @@ static int zynq_gem_miiphy_read(struct mii_dev *bus, int addr,
>  {
>         struct zynq_gem_priv *priv = bus->priv;
>         int ret;
> -       u16 val;
> +       u16 val = 0;
>
>         ret = phyread(priv, addr, reg, &val);
>         debug("%s 0x%x, 0x%x, 0x%x, 0x%x\n", __func__, addr, reg, val, ret);
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list