public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] [media] Staging: dt3155v4l: set error code on failure
@ 2014-05-09 11:55 Dan Carpenter
  2014-05-12  2:39 ` Jingoo Han
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-05-09 11:55 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Greg Kroah-Hartman, Hans Verkuil, Jingoo Han, Jon Mason,
	Russell King, Sakari Ailus, Kristina Martšenko, linux-media,
	devel, kernel-janitors

We should be returning -ENOMEM here instead of success.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c
index afbc2e5..178aa5b 100644
--- a/drivers/staging/media/dt3155v4l/dt3155v4l.c
+++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c
@@ -907,8 +907,10 @@ dt3155_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (!pd)
 		return -ENOMEM;
 	pd->vdev = video_device_alloc();
-	if (!pd->vdev)
+	if (!pd->vdev) {
+		err = -ENOMEM;
 		goto err_video_device_alloc;
+	}
 	*pd->vdev = dt3155_vdev;
 	pci_set_drvdata(pdev, pd);    /* for use in dt3155_remove() */
 	video_set_drvdata(pd->vdev, pd);  /* for use in video_fops */

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

* Re: [patch] [media] Staging: dt3155v4l: set error code on failure
  2014-05-09 11:55 [patch] [media] Staging: dt3155v4l: set error code on failure Dan Carpenter
@ 2014-05-12  2:39 ` Jingoo Han
  0 siblings, 0 replies; 2+ messages in thread
From: Jingoo Han @ 2014-05-12  2:39 UTC (permalink / raw)
  To: 'Dan Carpenter', 'Mauro Carvalho Chehab'
  Cc: 'Greg Kroah-Hartman', 'Hans Verkuil',
	'Jon Mason', 'Russell King',
	'Sakari Ailus', 'Kristina Martšenko',
	linux-media, devel, kernel-janitors, 'Jingoo Han'

On Friday, May 09, 2014 8:55 PM, Dan Carpenter wrote:
> 
> We should be returning -ENOMEM here instead of success.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

It looks good. video_device_alloc() calls kzalloc(); thus,
when video_device_alloc() returns NULL, '-ENOMEM' should be
returned.

Reviewed-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> 
> diff --git a/drivers/staging/media/dt3155v4l/dt3155v4l.c b/drivers/staging/media/dt3155v4l/dt3155v4l.c
> index afbc2e5..178aa5b 100644
> --- a/drivers/staging/media/dt3155v4l/dt3155v4l.c
> +++ b/drivers/staging/media/dt3155v4l/dt3155v4l.c
> @@ -907,8 +907,10 @@ dt3155_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  	if (!pd)
>  		return -ENOMEM;
>  	pd->vdev = video_device_alloc();
> -	if (!pd->vdev)
> +	if (!pd->vdev) {
> +		err = -ENOMEM;
>  		goto err_video_device_alloc;
> +	}
>  	*pd->vdev = dt3155_vdev;
>  	pci_set_drvdata(pdev, pd);    /* for use in dt3155_remove() */
>  	video_set_drvdata(pd->vdev, pd);  /* for use in video_fops */


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

end of thread, other threads:[~2014-05-12  2:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-09 11:55 [patch] [media] Staging: dt3155v4l: set error code on failure Dan Carpenter
2014-05-12  2:39 ` Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox