Skip to content

Commit 329328e

Browse files
Dan Carpenterzhenyw
authored andcommitted
drm/i915/gvt: Fix error code in intel_gvt_init_device()
The intel_gvt_init_vgpu_type_groups() function is only called from intel_gvt_init_device(). If it fails then the intel_gvt_init_device() prints the error code and propagates it back again. That's a bug because false is zero/success. The fix is to modify it to return zero or negative error codes and make everything consistent. Fixes: c5d71cb ("drm/i915/gvt: Move vGPU type related code into gvt file") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Zhenyu Wang <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/YHaFQtk/DIVYK1u5@mwanda Reviewed-by: Zhenyu Wang <[email protected]>
1 parent df2640b commit 329328e

File tree

1 file changed

+4
-4
lines changed
  • drivers/gpu/drm/i915/gvt

1 file changed

+4
-4
lines changed

drivers/gpu/drm/i915/gvt/gvt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ static bool intel_get_gvt_attrs(struct attribute_group ***intel_vgpu_type_groups
126126
return true;
127127
}
128128

129-
static bool intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt)
129+
static int intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt)
130130
{
131131
int i, j;
132132
struct intel_vgpu_type *type;
@@ -144,15 +144,15 @@ static bool intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt)
144144
gvt_vgpu_type_groups[i] = group;
145145
}
146146

147-
return true;
147+
return 0;
148148

149149
unwind:
150150
for (j = 0; j < i; j++) {
151151
group = gvt_vgpu_type_groups[j];
152152
kfree(group);
153153
}
154154

155-
return false;
155+
return -ENOMEM;
156156
}
157157

158158
static void intel_gvt_cleanup_vgpu_type_groups(struct intel_gvt *gvt)
@@ -360,7 +360,7 @@ int intel_gvt_init_device(struct drm_i915_private *i915)
360360
goto out_clean_thread;
361361

362362
ret = intel_gvt_init_vgpu_type_groups(gvt);
363-
if (ret == false) {
363+
if (ret) {
364364
gvt_err("failed to init vgpu type groups: %d\n", ret);
365365
goto out_clean_types;
366366
}

0 commit comments

Comments
 (0)