🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Wanhui Fu Thu, 26 Nov 2026 15:46
[PATCH] net: emac: Unmap emac phy base address and digital block
#23159
Author: Wanhui Fu
Date: Thu, 26 Nov 2026 15:46
44 lines
9633 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads