linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] media: s5p-mfc: fix a couple double frees in probe
@ 2016-06-11 19:56 Dan Carpenter
  2016-06-13 13:44 ` Javier Martinez Canillas
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-06-11 19:56 UTC (permalink / raw)
  To: Kyungmin Park, Javier Martinez Canillas
  Cc: Kamil Debski, Jeongtae Park, Mauro Carvalho Chehab, linux-media,
	linux-kernel, kernel-janitors

The extra calls to video_device_release() are a bug, we free these after
the goto.

Fixes: c974c436eaf4 ('s5p-mfc: Fix race between s5p_mfc_probe() and s5p_mfc_open()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This code would be easier to understand if it didn't use "come from"
style label names so that "goto release_dec;" would release dec etc
instead of "goto register_dec;"

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 6ee620e..274b4f1 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1266,7 +1266,6 @@ static int s5p_mfc_probe(struct platform_device *pdev)
 	ret = video_register_device(dev->vfd_dec, VFL_TYPE_GRABBER, 0);
 	if (ret) {
 		v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
-		video_device_release(dev->vfd_dec);
 		goto err_dec_reg;
 	}
 	v4l2_info(&dev->v4l2_dev,
@@ -1275,7 +1274,6 @@ static int s5p_mfc_probe(struct platform_device *pdev)
 	ret = video_register_device(dev->vfd_enc, VFL_TYPE_GRABBER, 0);
 	if (ret) {
 		v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
-		video_device_release(dev->vfd_enc);
 		goto err_enc_reg;
 	}
 	v4l2_info(&dev->v4l2_dev,

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

* Re: [patch] media: s5p-mfc: fix a couple double frees in probe
  2016-06-11 19:56 [patch] media: s5p-mfc: fix a couple double frees in probe Dan Carpenter
@ 2016-06-13 13:44 ` Javier Martinez Canillas
  0 siblings, 0 replies; 2+ messages in thread
From: Javier Martinez Canillas @ 2016-06-13 13:44 UTC (permalink / raw)
  To: Dan Carpenter, Shuah Khan
  Cc: Kyungmin Park, Javier Martinez Canillas, Kamil Debski,
	Jeongtae Park, Mauro Carvalho Chehab, Linux Media Mailing List,
	Linux Kernel, kernel-janitors

Hello Dan,

On Sat, Jun 11, 2016 at 3:56 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> The extra calls to video_device_release() are a bug, we free these after
> the goto.
>
> Fixes: c974c436eaf4 ('s5p-mfc: Fix race between s5p_mfc_probe() and s5p_mfc_open()')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---

Thanks for the patch but Shuah already posted the same fix before:

https://lkml.org/lkml/2016/6/8/1210

Best regards,
Javier

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

end of thread, other threads:[~2016-06-13 13:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-11 19:56 [patch] media: s5p-mfc: fix a couple double frees in probe Dan Carpenter
2016-06-13 13:44 ` Javier Martinez Canillas

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).