Skip to content

Commit

Permalink
drm/i915: check for oom when allocating private_default_ctx
Browse files Browse the repository at this point in the history
Found with smatch

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Mika Kuoppala authored and Daniel Vetter committed Feb 4, 2014
1 parent 76c3552 commit 7f76b23
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/i915/i915_gem_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,10 @@ int i915_gem_context_open(struct drm_device *dev, struct drm_file *file)
/* Cheat for hang stats */
file_priv->private_default_ctx =
kzalloc(sizeof(struct i915_hw_context), GFP_KERNEL);

if (file_priv->private_default_ctx == NULL)
return -ENOMEM;

file_priv->private_default_ctx->vm = &dev_priv->gtt.base;
return 0;
}
Expand Down

0 comments on commit 7f76b23

Please sign in to comment.