netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Angelo Daros de Luca <luizluca@gmail.com>
To: netdev@vger.kernel.org
Cc: linus.walleij@linaro.org, alsi@bang-olufsen.dk, andrew@lunn.ch,
	f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	arinc.unal@arinc9.com,
	Luiz Angelo Daros de Luca <luizluca@gmail.com>
Subject: [PATCH net-next 2/7] net: dsa: realtek: put of node after MDIO registration
Date: Fri,  8 Dec 2023 01:41:38 -0300	[thread overview]
Message-ID: <20231208045054.27966-3-luizluca@gmail.com> (raw)
In-Reply-To: <20231208045054.27966-1-luizluca@gmail.com>

If we don't keep a reference to the OF node, we can put it right after
we use it during MDIO registration.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
 drivers/net/dsa/realtek/realtek-smi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dsa/realtek/realtek-smi.c b/drivers/net/dsa/realtek/realtek-smi.c
index 755546ed8db6..ddcae546afbc 100644
--- a/drivers/net/dsa/realtek/realtek-smi.c
+++ b/drivers/net/dsa/realtek/realtek-smi.c
@@ -389,15 +389,15 @@ static int realtek_smi_setup_mdio(struct dsa_switch *ds)
 	priv->user_mii_bus->write = realtek_smi_mdio_write;
 	snprintf(priv->user_mii_bus->id, MII_BUS_ID_SIZE, "SMI-%d",
 		 ds->index);
-	priv->user_mii_bus->dev.of_node = mdio_np;
 	priv->user_mii_bus->parent = priv->dev;
 	ds->user_mii_bus = priv->user_mii_bus;
 
 	ret = devm_of_mdiobus_register(priv->dev, priv->user_mii_bus, mdio_np);
+	of_node_put(mdio_np);
 	if (ret) {
 		dev_err(priv->dev, "unable to register MDIO bus %s\n",
 			priv->user_mii_bus->id);
-		goto err_put_node;
+		return ret;
 	}
 
 	return 0;
@@ -514,8 +514,6 @@ static void realtek_smi_remove(struct platform_device *pdev)
 		return;
 
 	dsa_unregister_switch(priv->ds);
-	if (priv->user_mii_bus)
-		of_node_put(priv->user_mii_bus->dev.of_node);
 
 	/* leave the device reset asserted */
 	if (priv->reset)
-- 
2.43.0


  parent reply	other threads:[~2023-12-08  4:51 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08  4:41 [PATCH net-next 0/7] net: dsa: realtek: variants to drivers, interfaces to a common module Luiz Angelo Daros de Luca
2023-12-08  4:41 ` [PATCH net-next 1/7] net: dsa: realtek: drop cleanup from realtek_priv Luiz Angelo Daros de Luca
2023-12-08  9:49   ` Alvin Šipraga
2023-12-08  4:41 ` Luiz Angelo Daros de Luca [this message]
2023-12-08  5:13   ` [PATCH net-next 2/7] net: dsa: realtek: put of node after MDIO registration Luiz Angelo Daros de Luca
2023-12-08  9:49     ` Alvin Šipraga
2023-12-08 18:05       ` Luiz Angelo Daros de Luca
2023-12-11 17:11         ` Vladimir Oltean
2023-12-12  3:47           ` Luiz Angelo Daros de Luca
2023-12-12 21:58             ` Vladimir Oltean
2023-12-13  4:37               ` Luiz Angelo Daros de Luca
2023-12-13 13:04                 ` Vladimir Oltean
2023-12-16  4:26                   ` Luiz Angelo Daros de Luca
2023-12-08  4:41 ` [PATCH net-next 3/7] net: dsa: realtek: convert variants into a real driver Luiz Angelo Daros de Luca
2023-12-08 10:23   ` Alvin Šipraga
2023-12-08  4:41 ` [PATCH net-next 4/7] net: dsa: realtek: create realtek-common Luiz Angelo Daros de Luca
2023-12-08  5:01   ` Luiz Angelo Daros de Luca
2023-12-08 10:52   ` Alvin Šipraga
2023-12-11  5:02     ` Luiz Angelo Daros de Luca
2023-12-11  9:44       ` Alvin Šipraga
2023-12-08 14:02   ` Alvin Šipraga
2023-12-11  5:02     ` Luiz Angelo Daros de Luca
2023-12-11  9:24       ` Alvin Šipraga
2023-12-11 17:19         ` Vladimir Oltean
2023-12-08  4:41 ` [PATCH net-next 5/7] net: dsa: realtek: merge interface modules into common Luiz Angelo Daros de Luca
2023-12-08 10:57   ` Alvin Šipraga
2023-12-11  5:13     ` Luiz Angelo Daros de Luca
2023-12-11  9:25       ` Alvin Šipraga
2023-12-08  4:41 ` [PATCH net-next 6/7] net: dsa: realtek: migrate user_mii setup to common Luiz Angelo Daros de Luca
2023-12-08 11:05   ` Alvin Šipraga
2023-12-11  5:16     ` Luiz Angelo Daros de Luca
2023-12-08  4:41 ` [PATCH net-next 7/7] net: dsa: realtek: always use the realtek user mdio driver Luiz Angelo Daros de Luca
2023-12-08 11:06   ` Alvin Šipraga
2023-12-11  5:29     ` Luiz Angelo Daros de Luca

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=20231208045054.27966-3-luizluca@gmail.com \
    --to=luizluca@gmail.com \
    --cc=alsi@bang-olufsen.dk \
    --cc=andrew@lunn.ch \
    --cc=arinc.unal@arinc9.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).