public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Christian Marangi <ansuelsmth@gmail.com>
To: Tom Rini <trini@konsulko.com>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>,
	Weijie Gao <weijie.gao@mediatek.com>,
	Christian Marangi <ansuelsmth@gmail.com>,
	u-boot@lists.denx.de
Subject: [PATCH v2 3/5] net: mediatek: mt7988: free allocated MDIO bus on cleanup
Date: Sat, 20 Sep 2025 18:09:43 +0200	[thread overview]
Message-ID: <20250920161013.31799-4-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20250920161013.31799-1-ansuelsmth@gmail.com>

Correctly free the MDIO Bus on calling cleanup function. While at it
also fix a copy-paste error and rename the cleanup function name to the
more specific name.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/net/mtk_eth/mt7988.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mtk_eth/mt7988.c b/drivers/net/mtk_eth/mt7988.c
index 06bbe049da3..b77660be55c 100644
--- a/drivers/net/mtk_eth/mt7988.c
+++ b/drivers/net/mtk_eth/mt7988.c
@@ -142,11 +142,13 @@ static int mt7988_setup(struct mtk_eth_switch_priv *swpriv)
 	return mt7531_mdio_register(priv);
 }
 
-static int mt7531_cleanup(struct mtk_eth_switch_priv *swpriv)
+static int mt7988_cleanup(struct mtk_eth_switch_priv *swpriv)
 {
 	struct mt753x_switch_priv *priv = (struct mt753x_switch_priv *)swpriv;
+	struct mii_dev *mdio_bus = priv->mdio_bus;
 
-	mdio_unregister(priv->mdio_bus);
+	mdio_unregister(mdio_bus);
+	mdio_free(mdio_bus);
 
 	return 0;
 }
@@ -158,6 +160,6 @@ MTK_ETH_SWITCH(mt7988) = {
 	.reset_wait_time = 50,
 
 	.setup = mt7988_setup,
-	.cleanup = mt7531_cleanup,
+	.cleanup = mt7988_cleanup,
 	.mac_control = mt7988_mac_control,
 };
-- 
2.51.0


  parent reply	other threads:[~2025-09-20 16:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-20 16:09 [PATCH v2 0/5] net: mediatek: mt7988: various fixup + MDIO detach Christian Marangi
2025-09-20 16:09 ` [PATCH v2 1/5] net: mediatek: mt7531/7988: fix broken PHY turn ON/OFF Christian Marangi
2025-09-20 16:09 ` [PATCH v2 2/5] net: mediatek: mt7988: restore PHY page on PHY setting exit Christian Marangi
2025-09-20 16:09 ` Christian Marangi [this message]
2025-09-20 16:09 ` [PATCH v2 4/5] net: mediatek: move MT7531 MMIO MDIO to dedicated driver Christian Marangi
2025-09-20 16:09 ` [PATCH v2 5/5] net: airoha: bind MDIO controller on Ethernet load Christian Marangi
2025-10-22 13:42   ` Jerome Forissier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250920161013.31799-4-ansuelsmth@gmail.com \
    --to=ansuelsmth@gmail.com \
    --cc=joe.hershberger@ni.com \
    --cc=rfried.dev@gmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=weijie.gao@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox