[Mesa-dev] [PATCH v2 2/2] i915: remove unnecessary `if`

Eric Engestrom eric.engestrom at imgtec.com
Mon Aug 15 14:51:21 UTC 2016


	if (x) return true; else return false;
can be simplified as:
	return x;
since `x` is already a boolean expression.

Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
---

v2: replace `x == 0` with `!x` for consistency.

 src/mesa/drivers/dri/i915/intel_screen.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 77af328..73a109a 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -489,9 +489,7 @@ intel_query_image(__DRIimage *image, int attrib, int *value)
       *value = image->planar_format->components;
       return true;
    case __DRI_IMAGE_ATTRIB_FD:
-      if (drm_intel_bo_gem_export_to_prime(image->region->bo, value) == 0)
-         return true;
-      return false;
+      return !drm_intel_bo_gem_export_to_prime(image->region->bo, value);
   default:
       return false;
    }
-- 
2.9.2



More information about the mesa-dev mailing list