Commit f8871ec8 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Zhenyu Wang

drm/i915/gvt: no need to check return value of debugfs_create functions

When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Because there is no need to check these functions, a number of local
functions can be made to return void to simplify things as nothing can
fail.

Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Zhi Wang <zhi.a.wang@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gvt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZhenyu Wang <zhenyuw@linux.intel.com>
parent e14006d9
...@@ -189,36 +189,19 @@ DEFINE_SIMPLE_ATTRIBUTE(vgpu_scan_nonprivbb_fops, ...@@ -189,36 +189,19 @@ DEFINE_SIMPLE_ATTRIBUTE(vgpu_scan_nonprivbb_fops,
/** /**
* intel_gvt_debugfs_add_vgpu - register debugfs entries for a vGPU * intel_gvt_debugfs_add_vgpu - register debugfs entries for a vGPU
* @vgpu: a vGPU * @vgpu: a vGPU
*
* Returns:
* Zero on success, negative error code if failed.
*/ */
int intel_gvt_debugfs_add_vgpu(struct intel_vgpu *vgpu) void intel_gvt_debugfs_add_vgpu(struct intel_vgpu *vgpu)
{ {
struct dentry *ent;
char name[16] = ""; char name[16] = "";
snprintf(name, 16, "vgpu%d", vgpu->id); snprintf(name, 16, "vgpu%d", vgpu->id);
vgpu->debugfs = debugfs_create_dir(name, vgpu->gvt->debugfs_root); vgpu->debugfs = debugfs_create_dir(name, vgpu->gvt->debugfs_root);
if (!vgpu->debugfs)
return -ENOMEM;
ent = debugfs_create_bool("active", 0444, vgpu->debugfs,
&vgpu->active);
if (!ent)
return -ENOMEM;
ent = debugfs_create_file("mmio_diff", 0444, vgpu->debugfs,
vgpu, &vgpu_mmio_diff_fops);
if (!ent)
return -ENOMEM;
ent = debugfs_create_file("scan_nonprivbb", 0644, vgpu->debugfs, debugfs_create_bool("active", 0444, vgpu->debugfs, &vgpu->active);
vgpu, &vgpu_scan_nonprivbb_fops); debugfs_create_file("mmio_diff", 0444, vgpu->debugfs, vgpu,
if (!ent) &vgpu_mmio_diff_fops);
return -ENOMEM; debugfs_create_file("scan_nonprivbb", 0644, vgpu->debugfs, vgpu,
&vgpu_scan_nonprivbb_fops);
return 0;
} }
/** /**
...@@ -234,27 +217,15 @@ void intel_gvt_debugfs_remove_vgpu(struct intel_vgpu *vgpu) ...@@ -234,27 +217,15 @@ void intel_gvt_debugfs_remove_vgpu(struct intel_vgpu *vgpu)
/** /**
* intel_gvt_debugfs_init - register gvt debugfs root entry * intel_gvt_debugfs_init - register gvt debugfs root entry
* @gvt: GVT device * @gvt: GVT device
*
* Returns:
* zero on success, negative if failed.
*/ */
int intel_gvt_debugfs_init(struct intel_gvt *gvt) void intel_gvt_debugfs_init(struct intel_gvt *gvt)
{ {
struct drm_minor *minor = gvt->dev_priv->drm.primary; struct drm_minor *minor = gvt->dev_priv->drm.primary;
struct dentry *ent;
gvt->debugfs_root = debugfs_create_dir("gvt", minor->debugfs_root); gvt->debugfs_root = debugfs_create_dir("gvt", minor->debugfs_root);
if (!gvt->debugfs_root) {
gvt_err("Cannot create debugfs dir\n");
return -ENOMEM;
}
ent = debugfs_create_ulong("num_tracked_mmio", 0444, gvt->debugfs_root, debugfs_create_ulong("num_tracked_mmio", 0444, gvt->debugfs_root,
&gvt->mmio.num_tracked_mmio); &gvt->mmio.num_tracked_mmio);
if (!ent)
return -ENOMEM;
return 0;
} }
/** /**
......
...@@ -375,9 +375,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv) ...@@ -375,9 +375,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv)
} }
gvt->idle_vgpu = vgpu; gvt->idle_vgpu = vgpu;
ret = intel_gvt_debugfs_init(gvt); intel_gvt_debugfs_init(gvt);
if (ret)
gvt_err("debugfs registration failed, go on.\n");
gvt_dbg_core("gvt device initialization is done\n"); gvt_dbg_core("gvt device initialization is done\n");
dev_priv->gvt = gvt; dev_priv->gvt = gvt;
......
...@@ -682,9 +682,9 @@ static inline void intel_gvt_mmio_set_in_ctx( ...@@ -682,9 +682,9 @@ static inline void intel_gvt_mmio_set_in_ctx(
gvt->mmio.mmio_attribute[offset >> 2] |= F_IN_CTX; gvt->mmio.mmio_attribute[offset >> 2] |= F_IN_CTX;
} }
int intel_gvt_debugfs_add_vgpu(struct intel_vgpu *vgpu); void intel_gvt_debugfs_add_vgpu(struct intel_vgpu *vgpu);
void intel_gvt_debugfs_remove_vgpu(struct intel_vgpu *vgpu); void intel_gvt_debugfs_remove_vgpu(struct intel_vgpu *vgpu);
int intel_gvt_debugfs_init(struct intel_gvt *gvt); void intel_gvt_debugfs_init(struct intel_gvt *gvt);
void intel_gvt_debugfs_clean(struct intel_gvt *gvt); void intel_gvt_debugfs_clean(struct intel_gvt *gvt);
......
...@@ -1796,9 +1796,6 @@ static int kvmgt_guest_init(struct mdev_device *mdev) ...@@ -1796,9 +1796,6 @@ static int kvmgt_guest_init(struct mdev_device *mdev)
"kvmgt_nr_cache_entries", "kvmgt_nr_cache_entries",
0444, vgpu->debugfs, 0444, vgpu->debugfs,
&vgpu->vdev.nr_cache_entries); &vgpu->vdev.nr_cache_entries);
if (!info->debugfs_cache_entries)
gvt_vgpu_err("Cannot create kvmgt debugfs entry\n");
return 0; return 0;
} }
......
...@@ -420,9 +420,7 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt, ...@@ -420,9 +420,7 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
if (ret) if (ret)
goto out_clean_submission; goto out_clean_submission;
ret = intel_gvt_debugfs_add_vgpu(vgpu); intel_gvt_debugfs_add_vgpu(vgpu);
if (ret)
goto out_clean_sched_policy;
ret = intel_gvt_hypervisor_set_opregion(vgpu); ret = intel_gvt_hypervisor_set_opregion(vgpu);
if (ret) 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