Commit 5753394b authored by Jike Song's avatar Jike Song Committed by Zhenyu Wang

drm/i915/gvt/kvmgt: return meaningful error for vgpu creating failure

The vgpu_create() routine we called returns meaningful errors to indicate
failures, so we'd better to pass it to our caller, the mdev framework,
whereby the sysfs is able to tell userspace what happened.
Signed-off-by: default avatarJike Song <jike.song@intel.com>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
parent 03551e97
...@@ -398,6 +398,7 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) ...@@ -398,6 +398,7 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev)
struct intel_vgpu_type *type; struct intel_vgpu_type *type;
struct device *pdev; struct device *pdev;
void *gvt; void *gvt;
int ret;
pdev = mdev_parent_dev(mdev); pdev = mdev_parent_dev(mdev);
gvt = kdev_to_i915(pdev)->gvt; gvt = kdev_to_i915(pdev)->gvt;
...@@ -406,13 +407,15 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) ...@@ -406,13 +407,15 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev)
if (!type) { if (!type) {
gvt_err("failed to find type %s to create\n", gvt_err("failed to find type %s to create\n",
kobject_name(kobj)); kobject_name(kobj));
return -EINVAL; ret = -EINVAL;
goto out;
} }
vgpu = intel_gvt_ops->vgpu_create(gvt, type); vgpu = intel_gvt_ops->vgpu_create(gvt, type);
if (IS_ERR_OR_NULL(vgpu)) { if (IS_ERR_OR_NULL(vgpu)) {
gvt_err("create intel vgpu failed\n"); ret = vgpu == NULL ? -EFAULT : PTR_ERR(vgpu);
return -EINVAL; gvt_err("failed to create intel vgpu: %d\n", ret);
goto out;
} }
INIT_WORK(&vgpu->vdev.release_work, intel_vgpu_release_work); INIT_WORK(&vgpu->vdev.release_work, intel_vgpu_release_work);
...@@ -422,7 +425,10 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) ...@@ -422,7 +425,10 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev)
gvt_dbg_core("intel_vgpu_create succeeded for mdev: %s\n", gvt_dbg_core("intel_vgpu_create succeeded for mdev: %s\n",
dev_name(mdev_dev(mdev))); dev_name(mdev_dev(mdev)));
return 0; ret = 0;
out:
return ret;
} }
static int intel_vgpu_remove(struct mdev_device *mdev) static int intel_vgpu_remove(struct mdev_device *mdev)
......
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