linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: mx2_emmaprp: Fix memleak in emmaprp_probe
@ 2020-08-25  9:39 Dinghao Liu
  2020-08-26  8:56 ` Hans Verkuil
  0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2020-08-25  9:39 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Fabio Estevam, linux-media,
	linux-kernel

When platform_get_irq() fails, we should release
vfd and unregister pcdev->v4l2_dev just like the
subsequent error paths.

Fixes: d4e192cc44914 ("media: mx2_emmaprp: Check for platform_get_irq() error")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/media/platform/mx2_emmaprp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c
index df78df59da45..2fd31ed86005 100644
--- a/drivers/media/platform/mx2_emmaprp.c
+++ b/drivers/media/platform/mx2_emmaprp.c
@@ -853,7 +853,7 @@ static int emmaprp_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return irq;
+		goto rel_vdev;
 	ret = devm_request_irq(&pdev->dev, irq, emmaprp_irq, 0,
 			       dev_name(&pdev->dev), pcdev);
 	if (ret)
-- 
2.17.1


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

* Re: [PATCH] media: mx2_emmaprp: Fix memleak in emmaprp_probe
  2020-08-25  9:39 [PATCH] media: mx2_emmaprp: Fix memleak in emmaprp_probe Dinghao Liu
@ 2020-08-26  8:56 ` Hans Verkuil
  2020-08-26  9:14   ` dinghao.liu
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2020-08-26  8:56 UTC (permalink / raw)
  To: Dinghao Liu, kjlu
  Cc: Mauro Carvalho Chehab, Fabio Estevam, linux-media, linux-kernel

On 25/08/2020 11:39, Dinghao Liu wrote:
> When platform_get_irq() fails, we should release
> vfd and unregister pcdev->v4l2_dev just like the
> subsequent error paths.
> 
> Fixes: d4e192cc44914 ("media: mx2_emmaprp: Check for platform_get_irq() error")
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/media/platform/mx2_emmaprp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c
> index df78df59da45..2fd31ed86005 100644
> --- a/drivers/media/platform/mx2_emmaprp.c
> +++ b/drivers/media/platform/mx2_emmaprp.c
> @@ -853,7 +853,7 @@ static int emmaprp_probe(struct platform_device *pdev)
>  
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
> -		return irq;
> +		goto rel_vdev;

You need to add 'ret = irq;' here, otherwise the platform_get_irq error code
is not correctly propagated.

Looks good otherwise.

Regards,

	Hans

>  	ret = devm_request_irq(&pdev->dev, irq, emmaprp_irq, 0,
>  			       dev_name(&pdev->dev), pcdev);
>  	if (ret)
> 


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

* Re: Re: [PATCH] media: mx2_emmaprp: Fix memleak in emmaprp_probe
  2020-08-26  8:56 ` Hans Verkuil
@ 2020-08-26  9:14   ` dinghao.liu
  0 siblings, 0 replies; 3+ messages in thread
From: dinghao.liu @ 2020-08-26  9:14 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: kjlu, Mauro Carvalho Chehab, Fabio Estevam, linux-media, linux-kernel

> On 25/08/2020 11:39, Dinghao Liu wrote:
> > When platform_get_irq() fails, we should release
> > vfd and unregister pcdev->v4l2_dev just like the
> > subsequent error paths.
> > 
> > Fixes: d4e192cc44914 ("media: mx2_emmaprp: Check for platform_get_irq() error")
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> > ---
> >  drivers/media/platform/mx2_emmaprp.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c
> > index df78df59da45..2fd31ed86005 100644
> > --- a/drivers/media/platform/mx2_emmaprp.c
> > +++ b/drivers/media/platform/mx2_emmaprp.c
> > @@ -853,7 +853,7 @@ static int emmaprp_probe(struct platform_device *pdev)
> >  
> >  	irq = platform_get_irq(pdev, 0);
> >  	if (irq < 0)
> > -		return irq;
> > +		goto rel_vdev;
> 
> You need to add 'ret = irq;' here, otherwise the platform_get_irq error code
> is not correctly propagated.
> 

Thanks for pointing out that! I'll fix this and resend the patch soon.

Regards,
Dinghao

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

end of thread, other threads:[~2020-08-26  9:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25  9:39 [PATCH] media: mx2_emmaprp: Fix memleak in emmaprp_probe Dinghao Liu
2020-08-26  8:56 ` Hans Verkuil
2020-08-26  9:14   ` dinghao.liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).