]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
vfio-mdev: fix some error codes in the sample code
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 24 Nov 2016 11:27:26 +0000 (14:27 +0300)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 4 Jan 2017 15:32:23 +0000 (08:32 -0700)
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>
Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
samples/vfio-mdev/mtty.c

index 919c10d5b12e96c85701f8fc6439f64ae568a1f2..1fc57a5093a7be425406cca55f4eb994e2eb979e 100644 (file)
@@ -1449,6 +1449,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;
        }
 
@@ -1460,7 +1461,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);