Skip to contentSkip to conversation

net: ll_temac: Fix an NULL vs IS_ERR() check in temac_open()

PATCH Applied Dan Carpenter 2 participants 4 messages May 3, 2019 – May 5, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: ll_temac: Fix an NULL vs IS_ERR() check in temac_open()

The phy_connect() function doesn't return NULL pointers. It returns error pointers on error, so I have updated the check.

Fixes 8425c41d1ef7 ("net: ll_temac: Extend support to non-device-tree platforms")
---
 drivers/net/ethernet/xilinx/ll_temac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/xilinx/ll_temac_main.c +2 -2
index 1003ee14c833..bcb97fbf5b54 100644
@@ -927,9 +927,9 @@ static int temac_open(struct net_device *ndev)
 	} else if (strlen(lp->phy_name) > 0) {
 		phydev = phy_connect(lp->ndev, lp->phy_name, temac_adjust_link,
 				     lp->phy_interface);
-		if (!phydev) {
+		if (IS_ERR(phydev)) {
 			dev_err(lp->dev, "phy_connect() failed\n");
-			return -ENODEV;
+			return PTR_ERR(phydev);
 		}
 		phy_start(phydev);
 	}
Signature · 1 line
2.18.0
#1 lore raw

PATCH 2/2 net: ll_temac: remove an unnecessary condition

The "pdata->mdio_bus_id" is unsigned so this condition is always true. This patch just removes it.

---
 drivers/net/ethernet/xilinx/ll_temac_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xilinx/ll_temac_mdio.c +1 -1
index c2a11703bc6d..a4667326f745 100644
@@ -99,7 +99,7 @@ int temac_mdio_setup(struct temac_local *lp, struct platform_device *pdev)
 		of_address_to_resource(np, 0, &res);
 		snprintf(bus->id, MII_BUS_ID_SIZE, "%.8llx",
 			 (unsigned long long)res.start);
-	} else if (pdata && pdata->mdio_bus_id >= 0) {
+	} else if (pdata) {
 		snprintf(bus->id, MII_BUS_ID_SIZE, "%.8llx",
 			 pdata->mdio_bus_id);
 	}
Signature · 1 line
2.18.0