From: Wei Yongjun <[email protected]>

The dereference should be moved below the NULL test.

Signed-off-by: Wei Yongjun <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c 
b/drivers/gpu/drm/i915/i915_gem_context.c
index ff47145..f32107e 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -309,7 +309,7 @@ i915_gem_context_get_hang_stats(struct intel_ring_buffer 
*ring,
                                u32 id)
 {
        struct drm_i915_private *dev_priv = ring->dev->dev_private;
-       struct drm_i915_file_private *file_priv = file->driver_priv;
+       struct drm_i915_file_private *file_priv;
        struct i915_hw_context *to;
 
        if (dev_priv->hw_contexts_disabled)
@@ -321,6 +321,7 @@ i915_gem_context_get_hang_stats(struct intel_ring_buffer 
*ring,
        if (file == NULL)
                return ERR_PTR(-EINVAL);
 
+       file_priv = file->driver_priv;
        if (id == DEFAULT_CONTEXT_ID)
                return &file_priv->hang_stats;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to