diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2019-10-18 11:05:14 +0200 |
---|---|---|
committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2019-10-18 12:16:41 +0200 |
commit | fb26eee0600dbd6b2eb20356b7d425cb71413ea2 (patch) | |
tree | f06cadcedc26873a5ae3acd219776f713df75e5d /drivers/gpu/drm/i915/i915_pmu.c | |
parent | drm/i915: Pass in intel_gt at some for_each_engine sites (diff) | |
download | linux-fb26eee0600dbd6b2eb20356b7d425cb71413ea2.tar.xz linux-fb26eee0600dbd6b2eb20356b7d425cb71413ea2.zip |
drm/i915/pmu: Fix uninitialized variable on error path
If name allocation failed the log message will contain an uninitialized
error code which can be confusing.
Fixes: 05488673a4d4 ("drm/i915/pmu: Support multiple GPUs")
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20191018090514.1818-1-tvrtko.ursulin@linux.intel.com
[tursulin: Commit message spelling fix.]
Diffstat (limited to 'drivers/gpu/drm/i915/i915_pmu.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_pmu.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index 00fe401868c4..144c32eed045 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -1094,7 +1094,7 @@ static bool is_igp(struct drm_i915_private *i915) void i915_pmu_register(struct drm_i915_private *i915) { struct i915_pmu *pmu = &i915->pmu; - int ret; + int ret = -ENOMEM; if (INTEL_GEN(i915) <= 2) { dev_info(i915->drm.dev, "PMU not supported for this GPU."); @@ -1102,10 +1102,8 @@ void i915_pmu_register(struct drm_i915_private *i915) } i915_pmu_events_attr_group.attrs = create_event_attributes(pmu); - if (!i915_pmu_events_attr_group.attrs) { - ret = -ENOMEM; + if (!i915_pmu_events_attr_group.attrs) goto err; - } pmu->base.attr_groups = i915_pmu_attr_groups; pmu->base.task_ctx_nr = perf_invalid_context; |