Commit 987ca7ca authored by Wei Yongjun's avatar Wei Yongjun Committed by Vasily Gorbik

vfio-ccw: fix error return code in vfio_ccw_sch_init()

Fix to return negative error code -ENOMEM from the memory alloc failed
error handling case instead of 0, as done elsewhere in this function.

Fixes: 60e05d1c ("vfio-ccw: add some logging")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Link https://lore.kernel.org/kvm/20190904083315.105600-1-weiyongjun1@huawei.com/Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 024cdcdb
...@@ -317,15 +317,19 @@ static int __init vfio_ccw_sch_init(void) ...@@ -317,15 +317,19 @@ static int __init vfio_ccw_sch_init(void)
sizeof(struct ccw_io_region), 0, sizeof(struct ccw_io_region), 0,
SLAB_ACCOUNT, 0, SLAB_ACCOUNT, 0,
sizeof(struct ccw_io_region), NULL); sizeof(struct ccw_io_region), NULL);
if (!vfio_ccw_io_region) if (!vfio_ccw_io_region) {
ret = -ENOMEM;
goto out_err; goto out_err;
}
vfio_ccw_cmd_region = kmem_cache_create_usercopy("vfio_ccw_cmd_region", vfio_ccw_cmd_region = kmem_cache_create_usercopy("vfio_ccw_cmd_region",
sizeof(struct ccw_cmd_region), 0, sizeof(struct ccw_cmd_region), 0,
SLAB_ACCOUNT, 0, SLAB_ACCOUNT, 0,
sizeof(struct ccw_cmd_region), NULL); sizeof(struct ccw_cmd_region), NULL);
if (!vfio_ccw_cmd_region) if (!vfio_ccw_cmd_region) {
ret = -ENOMEM;
goto out_err; goto out_err;
}
isc_register(VFIO_CCW_ISC); isc_register(VFIO_CCW_ISC);
ret = css_driver_register(&vfio_ccw_sch_driver); ret = css_driver_register(&vfio_ccw_sch_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment