intel: Return if pointer to intel_context is null
authorAnuj Phogat <anuj.phogat@gmail.com>
Tue, 17 Jan 2012 21:21:52 +0000 (13:21 -0800)
committerAnuj Phogat <anuj.phogat@gmail.com>
Wed, 18 Jan 2012 00:58:38 +0000 (16:58 -0800)
It is better to test if(intel == NULL) and simply return in that case.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/intel/intel_screen.c

index a08f3d12b673f79c5d1710608aa61dc9bbcb6273..0566907fb3d9e726336be29b672f621c6ec64b66 100644 (file)
@@ -114,16 +114,16 @@ intelDRI2Flush(__DRIdrawable *drawable)
 {
    GET_CURRENT_CONTEXT(ctx);
    struct intel_context *intel = intel_context(ctx);
+   if (intel == NULL)
+      return;
 
-   if (intel != NULL) {
-      if (intel->gen < 4)
-        INTEL_FIREVERTICES(intel);
+   if (intel->gen < 4)
+      INTEL_FIREVERTICES(intel);
 
-      intel->need_throttle = true;
+   intel->need_throttle = true;
 
-      if (intel->batch.used)
-        intel_batchbuffer_flush(intel);
-   }
+   if (intel->batch.used)
+      intel_batchbuffer_flush(intel);
 }
 
 static const struct __DRI2flushExtensionRec intelFlushExtension = {