* [PATCH] media: am437x: Don't release OF node reference twice
@ 2015-02-23 14:49 Laurent Pinchart
2015-02-23 15:30 ` Lad, Prabhakar
2015-02-23 17:21 ` Benoit Parrot
0 siblings, 2 replies; 3+ messages in thread
From: Laurent Pinchart @ 2015-02-23 14:49 UTC (permalink / raw)
To: linux-media; +Cc: Benoit Parrot, Prabhakar Lad
The remote port reference is released both at the end of the OF graph
parsing loop, and in the error code path at the end of the function.
Those two calls will release the same reference, causing the reference
count to go negative.
Fix the problem by removing the second call.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/platform/am437x/am437x-vpfe.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
I've found this issue while reading the code, the patch hasn't been tested.
diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c
index 56a5cb0..ce273b2 100644
--- a/drivers/media/platform/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/am437x/am437x-vpfe.c
@@ -2425,7 +2425,7 @@ static int vpfe_async_complete(struct v4l2_async_notifier *notifier)
static struct vpfe_config *
vpfe_get_pdata(struct platform_device *pdev)
{
- struct device_node *endpoint = NULL, *rem = NULL;
+ struct device_node *endpoint = NULL;
struct v4l2_of_endpoint bus_cfg;
struct vpfe_subdev_info *sdinfo;
struct vpfe_config *pdata;
@@ -2443,6 +2443,8 @@ vpfe_get_pdata(struct platform_device *pdev)
return NULL;
for (i = 0; ; i++) {
+ struct device_node *rem;
+
endpoint = of_graph_get_next_endpoint(pdev->dev.of_node,
endpoint);
if (!endpoint)
@@ -2513,7 +2515,6 @@ vpfe_get_pdata(struct platform_device *pdev)
done:
of_node_put(endpoint);
- of_node_put(rem);
return NULL;
}
--
Regards,
Laurent Pinchart
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] media: am437x: Don't release OF node reference twice
2015-02-23 14:49 [PATCH] media: am437x: Don't release OF node reference twice Laurent Pinchart
@ 2015-02-23 15:30 ` Lad, Prabhakar
2015-02-23 17:21 ` Benoit Parrot
1 sibling, 0 replies; 3+ messages in thread
From: Lad, Prabhakar @ 2015-02-23 15:30 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media, Benoit Parrot
Hi Laurent,
Thanks for the patch.
On Mon, Feb 23, 2015 at 2:49 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> The remote port reference is released both at the end of the OF graph
> parsing loop, and in the error code path at the end of the function.
> Those two calls will release the same reference, causing the reference
> count to go negative.
>
> Fix the problem by removing the second call.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Thanks,
--Prabhakar Lad
> ---
> drivers/media/platform/am437x/am437x-vpfe.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> I've found this issue while reading the code, the patch hasn't been tested.
>
> diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c
> index 56a5cb0..ce273b2 100644
> --- a/drivers/media/platform/am437x/am437x-vpfe.c
> +++ b/drivers/media/platform/am437x/am437x-vpfe.c
> @@ -2425,7 +2425,7 @@ static int vpfe_async_complete(struct v4l2_async_notifier *notifier)
> static struct vpfe_config *
> vpfe_get_pdata(struct platform_device *pdev)
> {
> - struct device_node *endpoint = NULL, *rem = NULL;
> + struct device_node *endpoint = NULL;
> struct v4l2_of_endpoint bus_cfg;
> struct vpfe_subdev_info *sdinfo;
> struct vpfe_config *pdata;
> @@ -2443,6 +2443,8 @@ vpfe_get_pdata(struct platform_device *pdev)
> return NULL;
>
> for (i = 0; ; i++) {
> + struct device_node *rem;
> +
> endpoint = of_graph_get_next_endpoint(pdev->dev.of_node,
> endpoint);
> if (!endpoint)
> @@ -2513,7 +2515,6 @@ vpfe_get_pdata(struct platform_device *pdev)
>
> done:
> of_node_put(endpoint);
> - of_node_put(rem);
> return NULL;
> }
>
> --
> Regards,
>
> Laurent Pinchart
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] media: am437x: Don't release OF node reference twice
2015-02-23 14:49 [PATCH] media: am437x: Don't release OF node reference twice Laurent Pinchart
2015-02-23 15:30 ` Lad, Prabhakar
@ 2015-02-23 17:21 ` Benoit Parrot
1 sibling, 0 replies; 3+ messages in thread
From: Benoit Parrot @ 2015-02-23 17:21 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media, Prabhakar Lad
Thanks for the patch.
Acked-by: Benoit Parrot <bparrot@ti.com>
Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote on Mon [2015-Feb-23 16:49:21 +0200]:
> The remote port reference is released both at the end of the OF graph
> parsing loop, and in the error code path at the end of the function.
> Those two calls will release the same reference, causing the reference
> count to go negative.
>
> Fix the problem by removing the second call.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/media/platform/am437x/am437x-vpfe.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> I've found this issue while reading the code, the patch hasn't been tested.
>
> diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c
> index 56a5cb0..ce273b2 100644
> --- a/drivers/media/platform/am437x/am437x-vpfe.c
> +++ b/drivers/media/platform/am437x/am437x-vpfe.c
> @@ -2425,7 +2425,7 @@ static int vpfe_async_complete(struct v4l2_async_notifier *notifier)
> static struct vpfe_config *
> vpfe_get_pdata(struct platform_device *pdev)
> {
> - struct device_node *endpoint = NULL, *rem = NULL;
> + struct device_node *endpoint = NULL;
> struct v4l2_of_endpoint bus_cfg;
> struct vpfe_subdev_info *sdinfo;
> struct vpfe_config *pdata;
> @@ -2443,6 +2443,8 @@ vpfe_get_pdata(struct platform_device *pdev)
> return NULL;
>
> for (i = 0; ; i++) {
> + struct device_node *rem;
> +
> endpoint = of_graph_get_next_endpoint(pdev->dev.of_node,
> endpoint);
> if (!endpoint)
> @@ -2513,7 +2515,6 @@ vpfe_get_pdata(struct platform_device *pdev)
>
> done:
> of_node_put(endpoint);
> - of_node_put(rem);
> return NULL;
> }
>
> --
> Regards,
>
> Laurent Pinchart
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-23 17:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-23 14:49 [PATCH] media: am437x: Don't release OF node reference twice Laurent Pinchart
2015-02-23 15:30 ` Lad, Prabhakar
2015-02-23 17:21 ` Benoit Parrot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.