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>
This commit is contained in:
Mika Kuoppala 2014-01-31 17:00:28 +02:00 committed by Daniel Vetter
parent 76c3552f9f
commit 7f76b23aae
1 changed files with 4 additions and 0 deletions

View File

@ -489,6 +489,10 @@ int i915_gem_context_open(struct drm_device *dev, struct drm_file *file)
/* Cheat for hang stats */ /* Cheat for hang stats */
file_priv->private_default_ctx = file_priv->private_default_ctx =
kzalloc(sizeof(struct i915_hw_context), GFP_KERNEL); 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; file_priv->private_default_ctx->vm = &dev_priv->gtt.base;
return 0; return 0;
} }