summaryrefslogtreecommitdiffstats
path: root/samples/vfio-mdev/mtty.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-11-24 14:27:26 +0300
committerAlex Williamson <alex.williamson@redhat.com>2017-01-04 08:32:23 -0700
commitd293dbaa540b5800817cc10832d764b17cc211b5 (patch)
tree7a8e8bbc1c2d08ecdb8b0250ababae57949c5302 /samples/vfio-mdev/mtty.c
parent45e869714489431625c569d21fc952428d761476 (diff)
downloadlinux-d293dbaa540b5800817cc10832d764b17cc211b5.tar.gz
linux-d293dbaa540b5800817cc10832d764b17cc211b5.tar.bz2
linux-d293dbaa540b5800817cc10832d764b17cc211b5.zip
vfio-mdev: fix some error codes in the sample code
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>
Diffstat (limited to 'samples/vfio-mdev/mtty.c')
-rw-r--r--samples/vfio-mdev/mtty.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c
index 919c10d5b12e..1fc57a5093a7 100644
--- a/samples/vfio-mdev/mtty.c
+++ b/samples/vfio-mdev/mtty.c
@@ -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);