Skip to content

Commit

Permalink
drm/i915/gvt: return error when failing to take the module reference
Browse files Browse the repository at this point in the history
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: 9bdb073 ("drm/i915/gvt: Change KVMGT as self load module")
Reviewed-by: Zhenyu Wang <[email protected]>
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Xiongfeng Wang <[email protected]>
Signed-off-by: Zhenyu Wang <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
fenghusthu authored and zhenyw committed Nov 13, 2020
1 parent edb8d77 commit 4ec2b69
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/i915/gvt/kvmgt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4ec2b69

Please sign in to comment.