public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: remove redundant check on has_aliasing_ppgtt
@ 2017-10-10 13:47 Colin King
  2017-10-10 14:35 ` Joonas Lahtinen
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2017-10-10 13:47 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, David Airlie,
	intel-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

There is a previous check to on has_aliasing_ppgtt that returns
0 if it is false, so it is impossible for has_aliasing_ppgtt to
be false on the final return of function intel_sanitize_enable_ppgtt,
so final return in the function always will return 1.  Hence the
redundant ternary operator can be replaced with a return 1.

Detected by CoverityScan, CID#1357136 ("Logically dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 4c82ceb8d318..e1a318ea4327 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -188,7 +188,7 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
 			return 2;
 	}
 
-	return has_aliasing_ppgtt ? 1 : 0;
+	return 1;
 }
 
 static int ppgtt_bind_vma(struct i915_vma *vma,
-- 
2.14.1


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

* Re: [PATCH] drm/i915: remove redundant check on has_aliasing_ppgtt
  2017-10-10 13:47 [PATCH] drm/i915: remove redundant check on has_aliasing_ppgtt Colin King
@ 2017-10-10 14:35 ` Joonas Lahtinen
  2017-10-10 14:36   ` Colin Ian King
  0 siblings, 1 reply; 3+ messages in thread
From: Joonas Lahtinen @ 2017-10-10 14:35 UTC (permalink / raw)
  To: Colin King, Jani Nikula, Rodrigo Vivi, David Airlie, intel-gfx,
	dri-devel
  Cc: kernel-janitors, linux-kernel

On Tue, 2017-10-10 at 14:47 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There is a previous check to on has_aliasing_ppgtt that returns
> 0 if it is false, so it is impossible for has_aliasing_ppgtt to
> be false on the final return of function intel_sanitize_enable_ppgtt,
> so final return in the function always will return 1.  Hence the
> redundant ternary operator can be replaced with a return 1.
> 
> Detected by CoverityScan, CID#1357136 ("Logically dead code")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks, I took it a few steps further and removed the variable
altogether. I Cc'd you on the patch.

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation

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

* Re: [PATCH] drm/i915: remove redundant check on has_aliasing_ppgtt
  2017-10-10 14:35 ` Joonas Lahtinen
@ 2017-10-10 14:36   ` Colin Ian King
  0 siblings, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2017-10-10 14:36 UTC (permalink / raw)
  To: Joonas Lahtinen, Jani Nikula, Rodrigo Vivi, David Airlie,
	intel-gfx, dri-devel
  Cc: kernel-janitors, linux-kernel

On 10/10/17 15:35, Joonas Lahtinen wrote:
> On Tue, 2017-10-10 at 14:47 +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> There is a previous check to on has_aliasing_ppgtt that returns
>> 0 if it is false, so it is impossible for has_aliasing_ppgtt to
>> be false on the final return of function intel_sanitize_enable_ppgtt,
>> so final return in the function always will return 1.  Hence the
>> redundant ternary operator can be replaced with a return 1.
>>
>> Detected by CoverityScan, CID#1357136 ("Logically dead code")
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> 
> Thanks, I took it a few steps further and removed the variable
> altogether. I Cc'd you on the patch.

Yep, it's an improvement on my fix. Thanks for sorting that out.

Colin

> 
> Regards, Joonas
> 


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

end of thread, other threads:[~2017-10-10 14:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-10 13:47 [PATCH] drm/i915: remove redundant check on has_aliasing_ppgtt Colin King
2017-10-10 14:35 ` Joonas Lahtinen
2017-10-10 14:36   ` Colin Ian King

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