Commit 51cbbcd6 authored by Liang He's avatar Liang He Committed by Krzysztof Kozlowski
Browse files

w1: Add missing of_node_put() in w1.c



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: default avatarLiang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220615125105.3966317-1-windhl@126.com


[krzysztof: fix whitespace / checkpatch]
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
parent ecaed1a2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -692,6 +692,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;
	}