[U-Boot] [PATCH v2 3/3] net: miiphybb: fix casting error

Nobuhiro Iwamatsu iwamatsu at nigauri.org
Mon Nov 13 01:05:15 UTC 2017


Hi,

2017-11-03 22:30 GMT+09:00 Chris Brandt <chris.brandt at renesas.com>:
> Since the return value is a signed int, if the leading MSB of rdreg is a 1,
> it will get signed extended and will return a negative value which is an
> error even though we read the correct value.
>
> Fixes: dfcc496ed7e2 ("net: mii: Changes not made by spatch")
> Signed-off-by: Chris Brandt <chris.brandt at renesas.com>
Acked-by: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>

Best regards,
  Nobuhiro

> ---
>  drivers/net/phy/miiphybb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c
> index af676b9bae..d61722490e 100644
> --- a/drivers/net/phy/miiphybb.c
> +++ b/drivers/net/phy/miiphybb.c
> @@ -232,7 +232,7 @@ static void miiphy_pre(struct bb_miiphy_bus *bus, char read,
>   */
>  int bb_miiphy_read(struct mii_dev *miidev, int addr, int devad, int reg)
>  {
> -       short rdreg; /* register working value */
> +       unsigned short rdreg; /* register working value */
>         int v;
>         int j; /* counter */
>         struct bb_miiphy_bus *bus;
> --
> 2.14.1
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot



-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6


More information about the U-Boot mailing list