aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJike Song <jike.song@intel.com>2017-01-06 02:16:20 -0500
committerZhenyu Wang <zhenyuw@linux.intel.com>2017-01-08 22:11:52 -0500
commit5753394b64a07dd502cb288a5fd52e71fb01fc5d (patch)
tree4fbdfa530800684f2db81d96798b9e1f84235d9f
parent03551e971f6e52c8dedd5741bf48631e65675759 (diff)
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: Jike Song <jike.song@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
-rw-r--r--drivers/gpu/drm/i915/gvt/kvmgt.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index faaae07ae487..0c9234a87a20 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -398,6 +398,7 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev)
398 struct intel_vgpu_type *type; 398 struct intel_vgpu_type *type;
399 struct device *pdev; 399 struct device *pdev;
400 void *gvt; 400 void *gvt;
401 int ret;
401 402
402 pdev = mdev_parent_dev(mdev); 403 pdev = mdev_parent_dev(mdev);
403 gvt = kdev_to_i915(pdev)->gvt; 404 gvt = kdev_to_i915(pdev)->gvt;
@@ -406,13 +407,15 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev)
406 if (!type) { 407 if (!type) {
407 gvt_err("failed to find type %s to create\n", 408 gvt_err("failed to find type %s to create\n",
408 kobject_name(kobj)); 409 kobject_name(kobj));
409 return -EINVAL; 410 ret = -EINVAL;
411 goto out;
410 } 412 }
411 413
412 vgpu = intel_gvt_ops->vgpu_create(gvt, type); 414 vgpu = intel_gvt_ops->vgpu_create(gvt, type);
413 if (IS_ERR_OR_NULL(vgpu)) { 415 if (IS_ERR_OR_NULL(vgpu)) {
414 gvt_err("create intel vgpu failed\n"); 416 ret = vgpu == NULL ? -EFAULT : PTR_ERR(vgpu);
415 return -EINVAL; 417 gvt_err("failed to create intel vgpu: %d\n", ret);
418 goto out;
416 } 419 }
417 420
418 INIT_WORK(&vgpu->vdev.release_work, intel_vgpu_release_work); 421 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 425
423 gvt_dbg_core("intel_vgpu_create succeeded for mdev: %s\n", 426 gvt_dbg_core("intel_vgpu_create succeeded for mdev: %s\n",
424 dev_name(mdev_dev(mdev))); 427 dev_name(mdev_dev(mdev)));
425 return 0; 428 ret = 0;
429
430out:
431 return ret;
426} 432}
427 433
428static int intel_vgpu_remove(struct mdev_device *mdev) 434static int intel_vgpu_remove(struct mdev_device *mdev)