[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190310080856.4440-1-kjlu@umn.edu>
Date: Sun, 10 Mar 2019 03:08:56 -0500
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: pakki001@....edu, Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] net: lan9303: fix missing error handling
Both lan9303_phy_write and regmap_write may fail. The fix adds
the error handling to print error messages upon failure.
Signed-off-by: Kangjie Lu <kjlu@....edu>
---
drivers/net/dsa/lan9303-core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
index 2ffab7ee3d80..3f5e89f431f9 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
@@ -1072,6 +1072,10 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port,
ctl &= ~BMCR_FULLDPLX;
res = lan9303_phy_write(ds, port, MII_BMCR, ctl);
+ if (res) {
+ dev_err(ds->dev, "lan9303_phy_write failed: %d\n", res);
+ return;
+ }
if (port == chip->phy_addr_base) {
/* Virtual Phy: Remove Turbo 200Mbit mode */
@@ -1080,6 +1084,8 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port,
ctl &= ~LAN9303_VIRT_SPECIAL_TURBO;
res = regmap_write(chip->regmap,
LAN9303_VIRT_SPECIAL_CTRL, ctl);
+ if (res)
+ dev_err(ds->dev, "regmap_write failed: %d\n", res);
}
}
--
2.17.1
Powered by blists - more mailing lists