Commit 2dbfc652 authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Mauro Carvalho Chehab

media: i2c: tvp5150: Add of_node_put() before goto

Each iteration of for_each_available_child_of_node puts the previous
node, but in the case of a goto from the middle of the loop, there is
no put, thus causing a memory leak. Hence add an of_node_put before the
goto in four places.
Issue found with Coccinelle.
Signed-off-by: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 22ff7d4c
...@@ -1636,11 +1636,13 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np) ...@@ -1636,11 +1636,13 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
dev_err(decoder->sd.dev, dev_err(decoder->sd.dev,
"missing type property in node %pOFn\n", "missing type property in node %pOFn\n",
child); child);
of_node_put(child);
goto err_connector; goto err_connector;
} }
if (input_type >= TVP5150_INPUT_NUM) { if (input_type >= TVP5150_INPUT_NUM) {
ret = -EINVAL; ret = -EINVAL;
of_node_put(child);
goto err_connector; goto err_connector;
} }
...@@ -1651,6 +1653,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np) ...@@ -1651,6 +1653,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
dev_err(decoder->sd.dev, dev_err(decoder->sd.dev,
"input %s with same type already exists\n", "input %s with same type already exists\n",
input->name); input->name);
of_node_put(child);
ret = -EINVAL; ret = -EINVAL;
goto err_connector; goto err_connector;
} }
...@@ -1672,6 +1675,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np) ...@@ -1672,6 +1675,7 @@ static int tvp5150_parse_dt(struct tvp5150 *decoder, struct device_node *np)
dev_err(decoder->sd.dev, dev_err(decoder->sd.dev,
"missing label property in node %pOFn\n", "missing label property in node %pOFn\n",
child); child);
of_node_put(child);
goto err_connector; goto err_connector;
} }
......
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