diff mbox series

[net-next,v2,01/11] net: dpaa2-mac: allow lynx PCS to manage mdiodev lifetime

Message ID E1q6rnp-00Cfa5-P0@rmk-PC.armlinux.org.uk (mailing list archive)
State Accepted
Commit 6c79a9c8b1f3eb00b336fc2557fc5e1a5c15bd20
Delegated to: Netdev Maintainers
Headers show
Series complete Lynx mdio device handling | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Russell King (Oracle) June 7, 2023, 11:58 a.m. UTC
Put the mdiodev after lynx_pcs_create() so that the Lynx PCS driver
can manage the lifetime of the mdiodev its using.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
index cb70855e2b9a..c0f7dd3b4ac1 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
@@ -271,9 +271,9 @@  static int dpaa2_pcs_create(struct dpaa2_mac *mac,
 	}
 
 	mac->pcs = lynx_pcs_create(mdiodev);
+	mdio_device_put(mdiodev);
 	if (!mac->pcs) {
 		netdev_err(mac->net_dev, "lynx_pcs_create() failed\n");
-		mdio_device_free(mdiodev);
 		return -ENOMEM;
 	}
 
@@ -285,10 +285,7 @@  static void dpaa2_pcs_destroy(struct dpaa2_mac *mac)
 	struct phylink_pcs *phylink_pcs = mac->pcs;
 
 	if (phylink_pcs) {
-		struct mdio_device *mdio = lynx_get_mdio_device(phylink_pcs);
-
 		lynx_pcs_destroy(phylink_pcs);
-		mdio_device_free(mdio);
 		mac->pcs = NULL;
 	}
 }