summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@linux.intel.com>2014-01-31 17:00:28 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-02-04 12:10:26 +0100
commit7f76b23aae21890b28cf415a4f8123523a7abb24 (patch)
treeaaeee1a6f7de78013e71f4e8ed3e225b8eab1e33
parent76c3552f9f65005f406cbffe95b981e30ef51428 (diff)
drm/i915: check for oom when allocating private_default_ctx
Found with smatch Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_gem_context.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 985c1ed9f3f..19fd3629795 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -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;
}