Skip to contentSkip to conversation

input: touchscreen: ts4800-ts: add missing of_node_put after calling of_parse_phandle

PATCH In review Peter Chen 2 participants 2 messages Jul 15, 2016

Subsystems (2)
lore
Share & tools
lore

Peter Chen

author
#0 lore raw

PATCH 1/1 input: touchscreen: ts4800-ts: add missing of_node_put after calling of_parse_phandle

of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using.

Cc Rob Herring <[email protected]>
Cc Damien Riegel <[email protected]>
Cc Dmitry Torokhov <[email protected]>
---
 drivers/input/touchscreen/ts4800-ts.c | 1 +
 1 file changed, 1 insertion(+)
drivers/input/touchscreen/ts4800-ts.c +1 -0
index 3c3dd78..8f27ad8 100644
@@ -135,6 +135,7 @@ static int ts4800_parse_dt(struct platform_device *pdev,
 	ts->bit = BIT(bit);
 
 	ts->regmap = syscon_node_to_regmap(syscon_np);
+	of_node_put(syscon_np);
 	if (IS_ERR(ts->regmap)) {
 		dev_err(dev, "cannot get parent's regmap\n");
 		return PTR_ERR(ts->regmap);
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 17 lines · Peter Chen

of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using.

Cc Rob Herring <[email protected]>
Cc Damien Riegel <[email protected]>
Cc Dmitry Torokhov <[email protected]>
---
 drivers/input/touchscreen/ts4800-ts.c | 1 +
 1 file changed, 1 insertion(+)
drivers/input/touchscreen/ts4800-ts.c +0 -0
index 3c3dd78..8f27ad8 100644

drivers/input/touchscreen/ts4800-ts.c static int ts4800_parse_dt(struct platform_device *pdev, · line 138

Quoted 4 lines
drivers/input/touchscreen/ts4800-ts.c +1 -0
@@ -135,6 +135,7 @@ static int ts4800_parse_dt(struct platform_device *pdev,
 	ts->bit = BIT(bit);
 
 	ts->regmap = syscon_node_to_regmap(syscon_np);
+	of_node_put(syscon_np);

This does not help with the other 2 "returns" above which also leak the reference count. I'll switch the code around and apply.

Quoted 6 lines
drivers/input/touchscreen/ts4800-ts.c +0 -0
 	if (IS_ERR(ts->regmap)) {
 		dev_err(dev, "cannot get parent's regmap\n");
 		return PTR_ERR(ts->regmap);
Signature · 1 line
1.9.1

Thanks.

Signature · 1 line
Dmitry