kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] vfio-mdev: fix some error codes in the sample code
@ 2016-11-24 11:27 Dan Carpenter
  2016-11-28 12:12 ` Kirti Wankhede
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-11-24 11:27 UTC (permalink / raw)
  To: Kirti Wankhede; +Cc: kvm, kernel-janitors

This is just sample code.  We forget to set the error codes in a couple
places.

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

diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c
index 6b633a4..40ed3c0 100644
--- a/samples/vfio-mdev/mtty.c
+++ b/samples/vfio-mdev/mtty.c
@@ -1447,6 +1447,7 @@ static int __init mtty_dev_init(void)
 
 	if (IS_ERR(mtty_dev.vd_class)) {
 		pr_err("Error: failed to register mtty_dev class\n");
+		ret = PTR_ERR(mtty_dev.vd_class);
 		goto failed1;
 	}
 
@@ -1458,7 +1459,8 @@ static int __init mtty_dev_init(void)
 	if (ret)
 		goto failed2;
 
-	if (mdev_register_device(&mtty_dev.dev, &mdev_fops) != 0)
+	ret = mdev_register_device(&mtty_dev.dev, &mdev_fops);
+	if (ret)
 		goto failed3;
 
 	mutex_init(&mdev_list_lock);

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

* Re: [patch] vfio-mdev: fix some error codes in the sample code
  2016-11-24 11:27 [patch] vfio-mdev: fix some error codes in the sample code Dan Carpenter
@ 2016-11-28 12:12 ` Kirti Wankhede
  0 siblings, 0 replies; 2+ messages in thread
From: Kirti Wankhede @ 2016-11-28 12:12 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kvm, kernel-janitors



On 11/24/2016 4:57 PM, Dan Carpenter wrote:
> This is just sample code.  We forget to set the error codes in a couple
> places.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c
> index 6b633a4..40ed3c0 100644
> --- a/samples/vfio-mdev/mtty.c
> +++ b/samples/vfio-mdev/mtty.c
> @@ -1447,6 +1447,7 @@ static int __init mtty_dev_init(void)
>  
>  	if (IS_ERR(mtty_dev.vd_class)) {
>  		pr_err("Error: failed to register mtty_dev class\n");
> +		ret = PTR_ERR(mtty_dev.vd_class);
>  		goto failed1;
>  	}
>  
> @@ -1458,7 +1459,8 @@ static int __init mtty_dev_init(void)
>  	if (ret)
>  		goto failed2;
>  
> -	if (mdev_register_device(&mtty_dev.dev, &mdev_fops) != 0)
> +	ret = mdev_register_device(&mtty_dev.dev, &mdev_fops);
> +	if (ret)
>  		goto failed3;
>  
>  	mutex_init(&mdev_list_lock);
> 

Thanks for fixing this. Looks good to me.

Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>

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

end of thread, other threads:[~2016-11-28 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24 11:27 [patch] vfio-mdev: fix some error codes in the sample code Dan Carpenter
2016-11-28 12:12 ` Kirti Wankhede

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