From: Chris Brandt Date: Fri, 3 Nov 2017 13:30:13 +0000 (-0500) Subject: net: miiphybb: fix casting error X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=33bab1045773dea9f1bac24569a7f4e29072fd20;p=u-boot.git net: miiphybb: fix casting error 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 Acked-by: Nobuhiro Iwamatsu Acked-by: Joe Hershberger --- 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;