[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250207013117.104205-8-zhangzekun11@huawei.com>
Date: Fri, 7 Feb 2025 09:31:15 +0800
From: Zhang Zekun <zhangzekun11@...wei.com>
To: <robh@...nel.org>, <saravanak@...gle.com>, <justin.chen@...adcom.com>,
<florian.fainelli@...adcom.com>, <andrew+netdev@...n.ch>, <kuba@...nel.org>,
<o.rempel@...gutronix.de>, <kory.maincent@...tlin.com>,
<jacopo+renesas@...ndi.org>, <kieran.bingham+renesas@...asonboard.com>,
<laurent.pinchart+renesas@...asonboard.com>, <maddy@...ux.ibm.com>,
<mpe@...erman.id.au>, <npiggin@...il.com>, <olteanv@...il.com>,
<davem@...emloft.net>, <taras.chornyi@...ision.eu>, <edumazet@...gle.com>,
<pabeni@...hat.com>, <sudeep.holla@....com>, <cristian.marussi@....com>
CC: <arm-scmi@...r.kernel.org>, <linuxppc-dev@...ts.ozlabs.org>,
<linux-media@...r.kernel.org>, <netdev@...r.kernel.org>,
<devicetree@...r.kernel.org>, <chenjun102@...wei.com>,
<zhangzekun11@...wei.com>
Subject: [PATCH 7/9] net: dsa: hellcreek: Use of_find_node_by_name_balanced() to find device_node
Instead of directly using of_node_get() before of_find_node_by_name()
to balance the refcount of the device_node, using wraper function
of_find_node_by_name_balanced() to make code logic a bit simplier.
Signed-off-by: Zhang Zekun <zhangzekun11@...wei.com>
---
drivers/net/dsa/hirschmann/hellcreek_ptp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/dsa/hirschmann/hellcreek_ptp.c b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
index bfe21f9f7dcd..360ceb6831ed 100644
--- a/drivers/net/dsa/hirschmann/hellcreek_ptp.c
+++ b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
@@ -307,8 +307,7 @@ static int hellcreek_led_setup(struct hellcreek *hellcreek)
const char *label;
int ret = -EINVAL;
- of_node_get(hellcreek->dev->of_node);
- leds = of_find_node_by_name(hellcreek->dev->of_node, "leds");
+ leds = of_find_node_by_name_balanced(hellcreek->dev->of_node, "leds");
if (!leds) {
dev_err(hellcreek->dev, "No LEDs specified in device tree!\n");
return ret;
--
2.22.0
Powered by blists - more mailing lists