From 33bab1045773dea9f1bac24569a7f4e29072fd20 Mon Sep 17 00:00:00 2001 From: Chris Brandt Date: Fri, 3 Nov 2017 08:30:13 -0500 Subject: [PATCH] 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 --- 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.25.1