* [PATCH] media: ov5645: add missing of_node_put() in error path
@ 2018-03-19 16:14 Akinobu Mita
2018-03-21 7:26 ` Todor Tomov
0 siblings, 1 reply; 2+ messages in thread
From: Akinobu Mita @ 2018-03-19 16:14 UTC (permalink / raw)
To: linux-media
Cc: Akinobu Mita, Todor Tomov, Sakari Ailus, Mauro Carvalho Chehab
The device node obtained with of_graph_get_next_endpoint() should be
released by calling of_node_put(). But it was not released when
v4l2_fwnode_endpoint_parse() failed.
This change moves the of_node_put() call before the error check and
fixes the issue.
Cc: Todor Tomov <todor.tomov@linaro.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
drivers/media/i2c/ov5645.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
index d28845f..a31fe18 100644
--- a/drivers/media/i2c/ov5645.c
+++ b/drivers/media/i2c/ov5645.c
@@ -1131,13 +1131,14 @@ static int ov5645_probe(struct i2c_client *client,
ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
&ov5645->ep);
+
+ of_node_put(endpoint);
+
if (ret < 0) {
dev_err(dev, "parsing endpoint node failed\n");
return ret;
}
- of_node_put(endpoint);
-
if (ov5645->ep.bus_type != V4L2_MBUS_CSI2) {
dev_err(dev, "invalid bus type, must be CSI2\n");
return -EINVAL;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: ov5645: add missing of_node_put() in error path
2018-03-19 16:14 [PATCH] media: ov5645: add missing of_node_put() in error path Akinobu Mita
@ 2018-03-21 7:26 ` Todor Tomov
0 siblings, 0 replies; 2+ messages in thread
From: Todor Tomov @ 2018-03-21 7:26 UTC (permalink / raw)
To: Akinobu Mita, linux-media; +Cc: Sakari Ailus, Mauro Carvalho Chehab
Thank you Akinobu.
Acked-by: Todor Tomov <todor.tomov@linaro.org>
On 20.03.2018 00:14, Akinobu Mita wrote:
> The device node obtained with of_graph_get_next_endpoint() should be
> released by calling of_node_put(). But it was not released when
> v4l2_fwnode_endpoint_parse() failed.
>
> This change moves the of_node_put() call before the error check and
> fixes the issue.
>
> Cc: Todor Tomov <todor.tomov@linaro.org>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> ---
> drivers/media/i2c/ov5645.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
> index d28845f..a31fe18 100644
> --- a/drivers/media/i2c/ov5645.c
> +++ b/drivers/media/i2c/ov5645.c
> @@ -1131,13 +1131,14 @@ static int ov5645_probe(struct i2c_client *client,
>
> ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(endpoint),
> &ov5645->ep);
> +
> + of_node_put(endpoint);
> +
> if (ret < 0) {
> dev_err(dev, "parsing endpoint node failed\n");
> return ret;
> }
>
> - of_node_put(endpoint);
> -
> if (ov5645->ep.bus_type != V4L2_MBUS_CSI2) {
> dev_err(dev, "invalid bus type, must be CSI2\n");
> return -EINVAL;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-21 7:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-19 16:14 [PATCH] media: ov5645: add missing of_node_put() in error path Akinobu Mita
2018-03-21 7:26 ` Todor Tomov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox