diff mbox series

[net,2/2] net: pse-pd: Add missing of_node_get() before of_find_node_by_name()

Message ID 20241024015909.58654-3-zhangzekun11@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Get the device_node before calling of_find_node_by_name() | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5 this patch: 5
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 3 this patch: 3
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 Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-10-24--12-00 (tests: 777)

Commit Message

zhangzekun (A) Oct. 24, 2024, 1:59 a.m. UTC
of_find_node_by_name() will decrease the refount of the device_node.
So, get the device_node before passing to it.

Fixes: 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver")
Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
---
 drivers/net/pse-pd/tps23881.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Oleksij Rempel Oct. 24, 2024, 7:25 a.m. UTC | #1
On Thu, Oct 24, 2024 at 09:59:09AM +0800, Zhang Zekun wrote:
> of_find_node_by_name() will decrease the refount of the device_node.
> So, get the device_node before passing to it.
> 
> Fixes: 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver")
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>

Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>

Thank you!
Kory Maincent Oct. 24, 2024, 7:45 a.m. UTC | #2
On Thu, 24 Oct 2024 09:59:09 +0800
Zhang Zekun <zhangzekun11@huawei.com> wrote:

> of_find_node_by_name() will decrease the refount of the device_node.
> So, get the device_node before passing to it.
> 
> Fixes: 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver")
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>

Acked-by: Kory Maincent <kory.maincent@bootlin.com>

Thank you!
diff mbox series

Patch

diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
index 5c4e88be46ee..f5c04dd5be37 100644
--- a/drivers/net/pse-pd/tps23881.c
+++ b/drivers/net/pse-pd/tps23881.c
@@ -216,6 +216,7 @@  tps23881_get_of_channels(struct tps23881_priv *priv,
 	if (!priv->np)
 		return -EINVAL;
 
+	of_node_get(priv->np);
 	channels_node = of_find_node_by_name(priv->np, "channels");
 	if (!channels_node)
 		return -EINVAL;