linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: w1: Add missing of_node_put() in w1.c
@ 2022-06-15 12:51 Liang He
  2023-05-08  8:59 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-06-15 12:51 UTC (permalink / raw)
  To: zbr, jdelvare, linux; +Cc: linux-kernel, linux-hwmon, windhl

In __w1_attach_slave_device, we really need not to use of_node_put
in normal path as the reference is escaped by sl. However, we need
of_node_put in the fail path before put_device.

Signed-off-by: Liang He <windhl@126.com>
---
 drivers/w1/w1.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index f2ae2e563dc5..44a0587105a8 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -702,6 +702,7 @@ static int __w1_attach_slave_device(struct w1_slave *sl)
 		dev_err(&sl->dev,
 			"Device registration [%s] failed. err=%d\n",
 			dev_name(&sl->dev), err);
+		of_node_put(sl->dev.of_node);			
 		put_device(&sl->dev);
 		return err;
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers: w1: Add missing of_node_put() in w1.c
  2022-06-15 12:51 [PATCH] drivers: w1: Add missing of_node_put() in w1.c Liang He
@ 2023-05-08  8:59 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2023-05-08  8:59 UTC (permalink / raw)
  To: zbr, jdelvare, linux, Liang He
  Cc: Krzysztof Kozlowski, linux-kernel, linux-hwmon


On Wed, 15 Jun 2022 20:51:05 +0800, Liang He wrote:
> In __w1_attach_slave_device, we really need not to use of_node_put
> in normal path as the reference is escaped by sl. However, we need
> of_node_put in the fail path before put_device.
> 
> 

Applied, thanks!

[1/1] drivers: w1: Add missing of_node_put() in w1.c
      https://git.kernel.org/krzk/linux-w1/c/51cbbcd6469b2a32e222ec220039af20a16f2769

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-08  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 12:51 [PATCH] drivers: w1: Add missing of_node_put() in w1.c Liang He
2023-05-08  8:59 ` Krzysztof Kozlowski

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).