mirror of https://gitee.com/openkylin/linux.git
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:
parent
76c3552f9f
commit
7f76b23aae
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue