[ldv-project] [PATCH] mfd: ti_am335x_tscadc: release device nodes in ti_tscadc_probe()

Alexey Khoroshilov khoroshilov at ispras.ru
Fri Oct 26 23:59:56 MSK 2018


ti_tscadc_probe() increments refcnt of tsc and adc device nodes
and leaves it undecremented.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov at ispras.ru>
---
 drivers/mfd/ti_am335x_tscadc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index c2d47d78705b..6572232a5cef 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -142,16 +142,19 @@ static	int ti_tscadc_probe(struct platform_device *pdev)
 	node = of_get_child_by_name(pdev->dev.of_node, "tsc");
 	of_property_read_u32(node, "ti,wires", &tsc_wires);
 	of_property_read_u32(node, "ti,coordiante-readouts", &readouts);
+	of_node_put(node);
 
 	node = of_get_child_by_name(pdev->dev.of_node, "adc");
 	of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) {
 		adc_channels++;
 		if (val > 7) {
+			of_node_put(node);
 			dev_err(&pdev->dev, " PIN numbers are 0..7 (not %d)\n",
 					val);
 			return -EINVAL;
 		}
 	}
+	of_node_put(node);
 	total_channels = tsc_wires + adc_channels;
 	if (total_channels > 8) {
 		dev_err(&pdev->dev, "Number of i/p channels more than 8\n");
-- 
2.7.4




More information about the ldv-project mailing list