Commit 4ec2b69d authored by Xiongfeng Wang's avatar Xiongfeng Wang Committed by Zhenyu Wang

drm/i915/gvt: return error when failing to take the module reference

When we fail to take the module reference, we go to the 'undo*' branch and
return. But the returned variable 'ret' has been set as zero by the
above code. Change 'ret' to '-ENODEV' in this situation.

Fixes: 9bdb0734 ("drm/i915/gvt: Change KVMGT as self load module")
Reviewed-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1605187352-51761-1-git-send-email-wangxiongfeng2@huawei.com
parent edb8d77a
......@@ -829,8 +829,10 @@ static int intel_vgpu_open(struct mdev_device *mdev)
/* Take a module reference as mdev core doesn't take
* a reference for vendor driver.
*/
if (!try_module_get(THIS_MODULE))
if (!try_module_get(THIS_MODULE)) {
ret = -ENODEV;
goto undo_group;
}
ret = kvmgt_guest_init(mdev);
if (ret)
......
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