Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: emac: Unmap emac phy base address and digital block
@ 2026-11-26 15:46 Wanhui Fu
  2026-12-04 12:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Wanhui Fu @ 2026-11-26 15:46 UTC (permalink / raw)
  To: timur, andrew+netdev, davem, edumazet, kuba, pabeni; +Cc: netdev, Wanhui Fu

Commit 54e19bc74f33 ("net: qcom/emac: do not use devm on internal
phy pdev") used ioremap instead of devm_* in emac_sgmii_config().
https://lore.kernel.org/all/1474640854-1698-1-git-send-email-timur@codeaurora.org/

The error handling is also added inside emac_sgmii_config() and
emac_remove(), but missed in emac_probe(). Add corresponding
iounmap() in the error handling path. 

Found it by a self-developed static analysis tool and compile-
test passed.

Fixes: 54e19bc74f33 ("net: qcom/emac: do not use devm on internal phy pdev")
Signed-off-by: Wanhui Fu <fuwh1120@163.com>
---
 drivers/net/ethernet/qualcomm/emac/emac.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 699a8afc214a..aabc19a2a986 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac.c
@@ -660,7 +660,7 @@ static int emac_probe(struct platform_device *pdev)
 	ret = emac_clks_phase2_init(pdev, adpt);
 	if (ret) {
 		dev_err(&pdev->dev, "could not initialize clocks\n");
-		goto err_undo_mdiobus;
+		goto err_undo_sgmii;
 	}
 
 	/* set hw features */
@@ -707,6 +707,10 @@ static int emac_probe(struct platform_device *pdev)
 
 err_undo_napi:
 	netif_napi_del(&adpt->rx_q.napi);
+err_undo_sgmii:
+	if (adpt->phy.digital)
+		iounmap(adpt->phy.digital);
+	iounmap(adpt->phy.base);
 err_undo_mdiobus:
 	put_device(&adpt->phydev->mdio.dev);
 	mdiobus_unregister(adpt->mii_bus);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04 12:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 15:46 [PATCH] net: emac: Unmap emac phy base address and digital block Wanhui Fu
2026-12-04 12:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox