Commit 943bbe74 authored by Wei Yongjun's avatar Wei Yongjun Committed by Jonathan Cameron

iio: adc: ti-ads1015: add missing of_node_put() in ads1015_get_channels_config_of()

When terminating for_each_child_of_node() iteration with
break or return, of_node_put() should be used to prevent
stale device node references from being left behind.

This is detected by Coccinelle semantic patch.
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 16335bcb
...@@ -521,6 +521,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client) ...@@ -521,6 +521,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client)
if (pga > 6) { if (pga > 6) {
dev_err(&client->dev, "invalid gain on %s\n", dev_err(&client->dev, "invalid gain on %s\n",
node->full_name); node->full_name);
of_node_put(node);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -531,6 +532,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client) ...@@ -531,6 +532,7 @@ static int ads1015_get_channels_config_of(struct i2c_client *client)
dev_err(&client->dev, dev_err(&client->dev,
"invalid data_rate on %s\n", "invalid data_rate on %s\n",
node->full_name); node->full_name);
of_node_put(node);
return -EINVAL; return -EINVAL;
} }
} }
......
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