[Intel-gfx] [PATCH 2/2] drm/i915: Shrink i915_gem_request_add_to_client

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Tue Mar 22 17:16:53 UTC 2016


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

We do not need to check twice for the same conditions.

Results in clearer code and smaller binary.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 8588c83abb35..f7051df781d2 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1372,12 +1372,7 @@ int i915_gem_request_add_to_client(struct drm_i915_gem_request *req,
 {
 	struct drm_i915_file_private *file_priv;
 
-	WARN_ON(!req || !file || req->file_priv);
-
-	if (!req || !file)
-		return -EINVAL;
-
-	if (req->file_priv)
+	if (WARN_ON(!req || !file || req->file_priv))
 		return -EINVAL;
 
 	file_priv = file->driver_priv;
-- 
1.9.1



More information about the Intel-gfx mailing list