* [PATCH v2] phy: ti: j721e-wiz: Fix device node reference leak in wiz_get_lane_phy_types()
@ 2026-02-12 10:39 Felix Gu
2026-02-13 8:09 ` Markus Elfring
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Felix Gu @ 2026-02-12 10:39 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Kishon Vijay Abraham I, Jyri Sarha,
Vladimir Oltean
Cc: linux-phy, linux-kernel, Felix Gu
The serdes device_node is obtained using of_get_child_by_name(),
which increments the reference count. However, it is never put,
leading to a reference leak.
Add the missing of_node_put() calls to ensure the reference count is
properly balanced.
Fixes: 7ae14cf581f2 ("phy: ti: j721e-wiz: Implement DisplayPort mode to the wiz driver")
Suggested-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
Changes in v2:
- Use of_node_put() suggested by Vladimir Oltean.
- Link to v1: https://lore.kernel.org/r/20260211-wiz-v1-1-fdd018d02f33@gmail.com
---
drivers/phy/ti/phy-j721e-wiz.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
index 12a19bf2875c..10110cc2115b 100644
--- a/drivers/phy/ti/phy-j721e-wiz.c
+++ b/drivers/phy/ti/phy-j721e-wiz.c
@@ -1428,6 +1428,7 @@ static int wiz_get_lane_phy_types(struct device *dev, struct wiz *wiz)
dev_err(dev,
"%s: Reading \"reg\" from \"%s\" failed: %d\n",
__func__, subnode->name, ret);
+ of_node_put(serdes);
return ret;
}
of_property_read_u32(subnode, "cdns,num-lanes", &num_lanes);
@@ -1442,6 +1443,7 @@ static int wiz_get_lane_phy_types(struct device *dev, struct wiz *wiz)
}
}
+ of_node_put(serdes);
return 0;
}
---
base-commit: 193579fe01389bc21aff0051d13f24e8ea95b47d
change-id: 20260204-wiz-9a67604a034f
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v2] phy: ti: j721e-wiz: Fix device node reference leak in wiz_get_lane_phy_types()
2026-02-12 10:39 [PATCH v2] phy: ti: j721e-wiz: Fix device node reference leak in wiz_get_lane_phy_types() Felix Gu
@ 2026-02-13 8:09 ` Markus Elfring
2026-02-13 10:46 ` Vladimir Oltean
2026-02-13 10:47 ` Vladimir Oltean
2026-02-27 15:25 ` Vinod Koul
2 siblings, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2026-02-13 8:09 UTC (permalink / raw)
To: Felix Gu, linux-phy, Jyri Sarha, Kishon Vijay Abraham I,
Neil Armstrong, Vinod Koul, Vladimir Oltean
Cc: LKML, kernel-janitors
…
> ---
> Changes in v2:
> - Use of_node_put() suggested by Vladimir Oltean.
> - Link to v1: https://lore.kernel.org/r/20260211-wiz-v1-1-fdd018d02f33@gmail.com
> ---
> drivers/phy/ti/phy-j721e-wiz.c | 2 ++
…
* Would you like to complete the exception handling by using another goto chain?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.19#n526
* How do you think about to increase the application of scope-based resource management
by additional update steps?
https://elixir.bootlin.com/linux/v6.19-rc5/source/include/linux/cleanup.h#L157-L161
Regards,
Markus
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] phy: ti: j721e-wiz: Fix device node reference leak in wiz_get_lane_phy_types()
2026-02-13 8:09 ` Markus Elfring
@ 2026-02-13 10:46 ` Vladimir Oltean
0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2026-02-13 10:46 UTC (permalink / raw)
To: Markus Elfring
Cc: Felix Gu, linux-phy, Jyri Sarha, Kishon Vijay Abraham I,
Neil Armstrong, Vinod Koul, LKML, kernel-janitors
On Fri, Feb 13, 2026 at 09:09:55AM +0100, Markus Elfring wrote:
> …
> > ---
> > Changes in v2:
> > - Use of_node_put() suggested by Vladimir Oltean.
> > - Link to v1: https://lore.kernel.org/r/20260211-wiz-v1-1-fdd018d02f33@gmail.com
> > ---
> > drivers/phy/ti/phy-j721e-wiz.c | 2 ++
> …
>
> * Would you like to complete the exception handling by using another goto chain?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.19#n526
While gotos have their place, here it seems simpler not to use them.
Felix would have needed to move the "int ret" variable from the
for_each_child_of_node_scoped() scope to the function scope, and
initialize it with 0. All that is unnecessary complexity here.
> * How do you think about to increase the application of scope-based resource management
> by additional update steps?
> https://elixir.bootlin.com/linux/v6.19-rc5/source/include/linux/cleanup.h#L157-L161
The cleanup.h API does not exist in all kernels where this bug fix can
be backported.
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] phy: ti: j721e-wiz: Fix device node reference leak in wiz_get_lane_phy_types()
2026-02-12 10:39 [PATCH v2] phy: ti: j721e-wiz: Fix device node reference leak in wiz_get_lane_phy_types() Felix Gu
2026-02-13 8:09 ` Markus Elfring
@ 2026-02-13 10:47 ` Vladimir Oltean
2026-02-27 15:25 ` Vinod Koul
2 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2026-02-13 10:47 UTC (permalink / raw)
To: Felix Gu
Cc: Vinod Koul, Neil Armstrong, Kishon Vijay Abraham I, Jyri Sarha,
linux-phy, linux-kernel, Markus Elfring
On Thu, Feb 12, 2026 at 06:39:19PM +0800, Felix Gu wrote:
> The serdes device_node is obtained using of_get_child_by_name(),
> which increments the reference count. However, it is never put,
> leading to a reference leak.
>
> Add the missing of_node_put() calls to ensure the reference count is
> properly balanced.
>
> Fixes: 7ae14cf581f2 ("phy: ti: j721e-wiz: Implement DisplayPort mode to the wiz driver")
> Suggested-by: Vladimir Oltean <olteanv@gmail.com>
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
> Changes in v2:
> - Use of_node_put() suggested by Vladimir Oltean.
> - Link to v1: https://lore.kernel.org/r/20260211-wiz-v1-1-fdd018d02f33@gmail.com
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v2] phy: ti: j721e-wiz: Fix device node reference leak in wiz_get_lane_phy_types()
2026-02-12 10:39 [PATCH v2] phy: ti: j721e-wiz: Fix device node reference leak in wiz_get_lane_phy_types() Felix Gu
2026-02-13 8:09 ` Markus Elfring
2026-02-13 10:47 ` Vladimir Oltean
@ 2026-02-27 15:25 ` Vinod Koul
2 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2026-02-27 15:25 UTC (permalink / raw)
To: Neil Armstrong, Kishon Vijay Abraham I, Jyri Sarha,
Vladimir Oltean, Felix Gu
Cc: linux-phy, linux-kernel
On Thu, 12 Feb 2026 18:39:19 +0800, Felix Gu wrote:
> The serdes device_node is obtained using of_get_child_by_name(),
> which increments the reference count. However, it is never put,
> leading to a reference leak.
>
> Add the missing of_node_put() calls to ensure the reference count is
> properly balanced.
>
> [...]
Applied, thanks!
[1/1] phy: ti: j721e-wiz: Fix device node reference leak in wiz_get_lane_phy_types()
commit: 584b457f4166293bdfa50f930228e9fb91a38392
Best regards,
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-02-27 15:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-12 10:39 [PATCH v2] phy: ti: j721e-wiz: Fix device node reference leak in wiz_get_lane_phy_types() Felix Gu
2026-02-13 8:09 ` Markus Elfring
2026-02-13 10:46 ` Vladimir Oltean
2026-02-13 10:47 ` Vladimir Oltean
2026-02-27 15:25 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox