Skip to content

Commit d293dba

Browse files
Dan CarpenterAlex Williamson
authored andcommitted
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>
1 parent 45e8697 commit d293dba

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎samples/vfio-mdev/mtty.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,7 @@ static int __init mtty_dev_init(void)
14491449

14501450
if (IS_ERR(mtty_dev.vd_class)) {
14511451
pr_err("Error: failed to register mtty_dev class\n");
1452+
ret = PTR_ERR(mtty_dev.vd_class);
14521453
goto failed1;
14531454
}
14541455

@@ -1460,7 +1461,8 @@ static int __init mtty_dev_init(void)
14601461
if (ret)
14611462
goto failed2;
14621463

1463-
if (mdev_register_device(&mtty_dev.dev, &mdev_fops) != 0)
1464+
ret = mdev_register_device(&mtty_dev.dev, &mdev_fops);
1465+
if (ret)
14641466
goto failed3;
14651467

14661468
mutex_init(&mdev_list_lock);

0 commit comments

Comments
 (0)