summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ti_am335x_tscadc.c
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2021-10-15 10:14:26 +0200
committerLee Jones <lee.jones@linaro.org>2021-10-20 18:07:46 +0200
commit29f95e8bea2982a20280c1424dca643c3dc5f14d (patch)
tree1692341dc7958df2e23a6660d20f521669b96088 /drivers/mfd/ti_am335x_tscadc.c
parentdt-bindings: iio: adc: ti,am3359-adc: Describe am4372 ADC compatible (diff)
downloadlinux-29f95e8bea2982a20280c1424dca643c3dc5f14d.tar.xz
linux-29f95e8bea2982a20280c1424dca643c3dc5f14d.zip
mfd: ti_am335x_tscadc: Ensure a balanced number of node get/put
of_node_put() should be called after a successful of_get_child_by_name(). Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-9-miquel.raynal@bootlin.com
Diffstat (limited to 'drivers/mfd/ti_am335x_tscadc.c')
-rw-r--r--drivers/mfd/ti_am335x_tscadc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 55adc379f94b..eb5c23e3eacd 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -142,6 +142,7 @@ 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) {
@@ -149,9 +150,13 @@ static int ti_tscadc_probe(struct platform_device *pdev)
if (val > 7) {
dev_err(&pdev->dev, " PIN numbers are 0..7 (not %d)\n",
val);
+ of_node_put(node);
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");