All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: coda: Fix missing put_device() call in coda_get_vdoa_data
@ 2022-01-07  8:18 Miaoqian Lin
  2022-01-11 10:06 ` Hans Verkuil
  0 siblings, 1 reply; 3+ messages in thread
From: Miaoqian Lin @ 2022-01-07  8:18 UTC (permalink / raw)
  Cc: linmq006, Philipp Zabel, Mauro Carvalho Chehab, Michael Tretter,
	Hans Verkuil, linux-media, linux-kernel

The reference taken by 'of_find_device_by_node()' must be released when
not needed anymore.
Add the corresponding 'put_device()' in the error handling path.

Fixes: e7f3c5481035 ("[media] coda: use VDOA for un-tiling custom macroblock format")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/media/platform/coda/coda-common.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 0e312b0842d7..579849082488 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -405,9 +405,13 @@ static struct vdoa_data *coda_get_vdoa_data(void)
 		goto out;
 
 	vdoa_data = platform_get_drvdata(vdoa_pdev);
-	if (!vdoa_data)
+	if (!vdoa_data) {
 		vdoa_data = ERR_PTR(-EPROBE_DEFER);
+		goto put;
+	}
 
+put:
+	put_device(&vdoa_pdev->dev);
 out:
 	of_node_put(vdoa_node);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: coda: Fix missing put_device() call in coda_get_vdoa_data
  2022-01-07  8:18 [PATCH] media: coda: Fix missing put_device() call in coda_get_vdoa_data Miaoqian Lin
@ 2022-01-11 10:06 ` Hans Verkuil
  2022-01-12 11:05   ` [PATCH v2] " Miaoqian Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2022-01-11 10:06 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Philipp Zabel, Mauro Carvalho Chehab, Michael Tretter,
	Hans Verkuil, linux-media, linux-kernel

On 07/01/2022 09:18, Miaoqian Lin wrote:
> The reference taken by 'of_find_device_by_node()' must be released when
> not needed anymore.
> Add the corresponding 'put_device()' in the error handling path.
> 
> Fixes: e7f3c5481035 ("[media] coda: use VDOA for un-tiling custom macroblock format")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/media/platform/coda/coda-common.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
> index 0e312b0842d7..579849082488 100644
> --- a/drivers/media/platform/coda/coda-common.c
> +++ b/drivers/media/platform/coda/coda-common.c
> @@ -405,9 +405,13 @@ static struct vdoa_data *coda_get_vdoa_data(void)
>  		goto out;
>  
>  	vdoa_data = platform_get_drvdata(vdoa_pdev);
> -	if (!vdoa_data)
> +	if (!vdoa_data) {
>  		vdoa_data = ERR_PTR(-EPROBE_DEFER);
> +		goto put;

Why the goto put? Just drop the goto...

> +	}
>  
> +put:

...and this label.

> +	put_device(&vdoa_pdev->dev);

This is the real fix :-)

Regards,

	Hans

>  out:
>  	of_node_put(vdoa_node);
>  


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] media: coda: Fix missing put_device() call in coda_get_vdoa_data
  2022-01-11 10:06 ` Hans Verkuil
@ 2022-01-12 11:05   ` Miaoqian Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Miaoqian Lin @ 2022-01-12 11:05 UTC (permalink / raw)
  To: hverkuil
  Cc: hans.verkuil, linmq006, linux-kernel, linux-media, m.tretter,
	mchehab, p.zabel

The reference taken by 'of_find_device_by_node()' must be released when
not needed anymore.
Add the corresponding 'put_device()' in the error handling path.

Fixes: e7f3c5481035 ("[media] coda: use VDOA for un-tiling custom macroblock format")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
Changes in v2:
- remove the goto and unused label.
---
 drivers/media/platform/coda/coda-common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 0e312b0842d7..c3942b0abb00 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -408,6 +408,7 @@ static struct vdoa_data *coda_get_vdoa_data(void)
 	if (!vdoa_data)
 		vdoa_data = ERR_PTR(-EPROBE_DEFER);
 
+	put_device(&vdoa_pdev->dev);
 out:
 	of_node_put(vdoa_node);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-12 11:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07  8:18 [PATCH] media: coda: Fix missing put_device() call in coda_get_vdoa_data Miaoqian Lin
2022-01-11 10:06 ` Hans Verkuil
2022-01-12 11:05   ` [PATCH v2] " Miaoqian Lin

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.