Commit 29f95e8b authored by Miquel Raynal's avatar Miquel Raynal Committed by Lee Jones

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: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211015081506.933180-9-miquel.raynal@bootlin.com
parent d9d604c7
...@@ -142,6 +142,7 @@ static int ti_tscadc_probe(struct platform_device *pdev) ...@@ -142,6 +142,7 @@ static int ti_tscadc_probe(struct platform_device *pdev)
node = of_get_child_by_name(pdev->dev.of_node, "tsc"); 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,wires", &tsc_wires);
of_property_read_u32(node, "ti,coordiante-readouts", &readouts); of_property_read_u32(node, "ti,coordiante-readouts", &readouts);
of_node_put(node);
node = of_get_child_by_name(pdev->dev.of_node, "adc"); node = of_get_child_by_name(pdev->dev.of_node, "adc");
of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) { 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) ...@@ -149,9 +150,13 @@ static int ti_tscadc_probe(struct platform_device *pdev)
if (val > 7) { if (val > 7) {
dev_err(&pdev->dev, " PIN numbers are 0..7 (not %d)\n", dev_err(&pdev->dev, " PIN numbers are 0..7 (not %d)\n",
val); val);
of_node_put(node);
return -EINVAL; return -EINVAL;
} }
} }
of_node_put(node);
total_channels = tsc_wires + adc_channels; total_channels = tsc_wires + adc_channels;
if (total_channels > 8) { if (total_channels > 8) {
dev_err(&pdev->dev, "Number of i/p channels more than 8\n"); dev_err(&pdev->dev, "Number of i/p channels more than 8\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment