linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915/guc: remove redundant GEM_BUG_ON check
@ 2018-06-11 16:00 Colin King
  2018-06-11 16:25 ` [Intel-gfx] " Ville Syrjälä
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2018-06-11 16:00 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>

The check for level being less than zero is redundant as level
is an unsigned u32 and hence will never be less than zero.
Remove this redundant check.

Detected by CoverityScan, CID#1468363 ("Macro compares unsigned to 0")

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

diff --git a/drivers/gpu/drm/i915/intel_guc.c b/drivers/gpu/drm/i915/intel_guc.c
index 116f4ccf1bbd..a2f782a4f97d 100644
--- a/drivers/gpu/drm/i915/intel_guc.c
+++ b/drivers/gpu/drm/i915/intel_guc.c
@@ -208,8 +208,6 @@ static u32 get_log_control_flags(void)
 	u32 level = i915_modparams.guc_log_level;
 	u32 flags = 0;
 
-	GEM_BUG_ON(level < 0);
-
 	if (!GUC_LOG_LEVEL_IS_ENABLED(level))
 		flags |= GUC_LOG_DEFAULT_DISABLED;
 
-- 
2.17.0

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

* Re: [Intel-gfx] [PATCH] drm/i915/guc: remove redundant GEM_BUG_ON check
  2018-06-11 16:00 [PATCH] drm/i915/guc: remove redundant GEM_BUG_ON check Colin King
@ 2018-06-11 16:25 ` Ville Syrjälä
  2018-06-11 16:37   ` Colin Ian King
  0 siblings, 1 reply; 3+ messages in thread
From: Ville Syrjälä @ 2018-06-11 16:25 UTC (permalink / raw)
  To: Colin King
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, David Airlie,
	intel-gfx, dri-devel, kernel-janitors, linux-kernel

On Mon, Jun 11, 2018 at 05:00:37PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The check for level being less than zero is redundant as level
> is an unsigned u32 and hence will never be less than zero.
> Remove this redundant check.
> 
> Detected by CoverityScan, CID#1468363 ("Macro compares unsigned to 0")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/gpu/drm/i915/intel_guc.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_guc.c b/drivers/gpu/drm/i915/intel_guc.c
> index 116f4ccf1bbd..a2f782a4f97d 100644
> --- a/drivers/gpu/drm/i915/intel_guc.c
> +++ b/drivers/gpu/drm/i915/intel_guc.c
> @@ -208,8 +208,6 @@ static u32 get_log_control_flags(void)
>  	u32 level = i915_modparams.guc_log_level;
>  	u32 flags = 0;
>  
> -	GEM_BUG_ON(level < 0);

i915_modparams.guc_log_level is a signed int. So s/u32/int would seem
like a better fix.

> -
>  	if (!GUC_LOG_LEVEL_IS_ENABLED(level))
>  		flags |= GUC_LOG_DEFAULT_DISABLED;
>  
> -- 
> 2.17.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel

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

* Re: [Intel-gfx] [PATCH] drm/i915/guc: remove redundant GEM_BUG_ON check
  2018-06-11 16:25 ` [Intel-gfx] " Ville Syrjälä
@ 2018-06-11 16:37   ` Colin Ian King
  0 siblings, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2018-06-11 16:37 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, David Airlie,
	intel-gfx, dri-devel, kernel-janitors, linux-kernel

On 11/06/18 17:25, Ville Syrjälä wrote:
> On Mon, Jun 11, 2018 at 05:00:37PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The check for level being less than zero is redundant as level
>> is an unsigned u32 and hence will never be less than zero.
>> Remove this redundant check.
>>
>> Detected by CoverityScan, CID#1468363 ("Macro compares unsigned to 0")
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>  drivers/gpu/drm/i915/intel_guc.c | 2 --
>>  1 file changed, 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_guc.c b/drivers/gpu/drm/i915/intel_guc.c
>> index 116f4ccf1bbd..a2f782a4f97d 100644
>> --- a/drivers/gpu/drm/i915/intel_guc.c
>> +++ b/drivers/gpu/drm/i915/intel_guc.c
>> @@ -208,8 +208,6 @@ static u32 get_log_control_flags(void)
>>  	u32 level = i915_modparams.guc_log_level;
>>  	u32 flags = 0;
>>  
>> -	GEM_BUG_ON(level < 0);
> 
> i915_modparams.guc_log_level is a signed int. So s/u32/int would seem
> like a better fix.

Good point, I somehow thought it  guc_loc_level was unsigned, but I was
wrong. Sending a V2.

> 
>> -
>>  	if (!GUC_LOG_LEVEL_IS_ENABLED(level))
>>  		flags |= GUC_LOG_DEFAULT_DISABLED;
>>  
>> -- 
>> 2.17.0
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 


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

end of thread, other threads:[~2018-06-11 17:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11 16:00 [PATCH] drm/i915/guc: remove redundant GEM_BUG_ON check Colin King
2018-06-11 16:25 ` [Intel-gfx] " Ville Syrjälä
2018-06-11 16:37   ` 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;
as well as URLs for NNTP newsgroup(s).