public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/ppgtt: Never return a NULL context
@ 2013-12-22 20:55 Ben Widawsky
  2014-01-01  5:46 ` [PATCH] [v2] " Ben Widawsky
  0 siblings, 1 reply; 17+ messages in thread
From: Ben Widawsky @ 2013-12-22 20:55 UTC (permalink / raw)
  To: Intel GFX; +Cc: Ben Widawsky, Ben Widawsky

It makes all the code which calls into this function way too confusing.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72903

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index ebe0f67..4794c18 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -526,10 +526,16 @@ void i915_gem_context_close(struct drm_device *dev, struct drm_file *file)
 struct i915_hw_context *
 i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id)
 {
+	struct i915_hw_context *ctx;
+
 	if (!HAS_HW_CONTEXTS(file_priv->dev_priv->dev))
 		return file_priv->private_default_ctx;
 
-	return (struct i915_hw_context *)idr_find(&file_priv->context_idr, id);
+	ctx = (struct i915_hw_context *)idr_find(&file_priv->context_idr, id);
+	if (!ctx)
+		return ERR_PTR(-ENOENT);
+
+	return ctx;
 }
 
 static inline int
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-02-23 20:32 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <to=1388555170-19936-1-git-send-email-benjamin.widawsky@intel.com>
2014-01-03  5:50 ` [PATCH] [v2] drm/i915/ppgtt: Never return a NULL context Ben Widawsky
2014-01-03  5:50   ` [PATCH 2/3] drm/i915: set ctx->initialized only after RCS Ben Widawsky
2014-01-03  5:50   ` [PATCH 3/3] drm/i915: Make file default context persistent Ben Widawsky
2014-01-03  5:50   ` [PATCH 1/5] intel: squash unused variable 'bo_gem' Ben Widawsky
2014-01-03  5:50   ` [PATCH 2/5] intel: Handle malloc fails in context create Ben Widawsky
2014-01-03  5:50   ` [PATCH 3/5] intel: Merge latest i915_drm.h Ben Widawsky
2014-01-03  5:50   ` [PATCH 4/5] intel: Intel full PPGTT param Ben Widawsky
2014-01-07  7:53     ` Daniel Vetter
2014-01-09 23:20       ` Ben Widawsky
2014-01-03  5:50   ` [PATCH 5/5] configure.ac: bump version to 2.4.51 for release Ben Widawsky
2014-01-03  5:50   ` [PATCH] i965: Use default contexts when possible Ben Widawsky
2014-02-23 20:32     ` [Intel-gfx] " Ben Widawsky
2014-01-03 12:07   ` [PATCH] [v2] drm/i915/ppgtt: Never return a NULL context Mika Kuoppala
2014-01-07  7:51     ` Daniel Vetter
     [not found]       ` <CALNAZXq8EZ4Wmq2ONz08gNFcEv4Bi-JzBasEvnAKWEfEWyf_xw@mail.gmail.com>
     [not found]         ` <CAKMK7uE9aai27U7jwGe0jK5AzjxKx40z8VyS1D4mr__a5x-Qeg@mail.gmail.com>
2014-01-10 23:20           ` Daniel Vetter
2013-12-22 20:55 [PATCH] " Ben Widawsky
2014-01-01  5:46 ` [PATCH] [v2] " Ben Widawsky
2014-01-02 14:34   ` Mika Kuoppala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox