lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87y1lbigsr.fsf@intel.com>
Date:   Fri, 26 May 2023 12:27:16 +0300
From:   Jani Nikula <jani.nikula@...ux.intel.com>
To:     Tom Rix <trix@...hat.com>, joonas.lahtinen@...ux.intel.com,
        rodrigo.vivi@...el.com, tvrtko.ursulin@...ux.intel.com,
        airlied@...il.com, daniel@...ll.ch, nathan@...nel.org,
        ndesaulniers@...gle.com, ville.syrjala@...ux.intel.com,
        imre.deak@...el.com, arun.r.murthy@...el.com,
        lucas.demarchi@...el.com
Cc:     Tom Rix <trix@...hat.com>, intel-gfx@...ts.freedesktop.org,
        llvm@...ts.linux.dev, linux-kernel@...r.kernel.org,
        dri-devel@...ts.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: simplify switch to if-elseif

On Tue, 23 May 2023, Jani Nikula <jani.nikula@...ux.intel.com> wrote:
> On Tue, 23 May 2023, Tom Rix <trix@...hat.com> wrote:
>> clang with W=1 reports
>> drivers/gpu/drm/i915/display/intel_display.c:6012:3: error: unannotated
>>   fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
>>                 case I915_FORMAT_MOD_X_TILED:
>>                 ^
>>
>> Only one case and the default does anything in this switch, so it should
>> be changed to an if-elseif.
>
> Thanks for the patch.
>
> If I wanted to fix this quickly, I'd just add the break in there.

I've just applied [1] doing this.

I'm still open to the cleanup suggested below, if you're up for it.


BR,
Jani.


[1] https://patchwork.freedesktop.org/patch/msgid/20230524-intel_async_flip_check_hw-implicit-fallthrough-v1-1-83de89e376a1@kernel.org

>
> If I wanted to fix this properly, I'd add a function
> modifier_supports_async_flips() or something, and replace the switch
> with:
>
> 	if (!modifier_supports_async_flips(i915, new_plane_state->hw.fb->modifier)) {
> 		drm_dbg_kms(&i915->drm, "[PLANE:%d:%s] Modifier does not support async flips\n",
> 			plane->base.base.id, plane->base.name);
> 		return -EINVAL;
> 	}
>
> But I wouldn't just replace the switch with if-elseif. It doesn't help
> with the overall feeling that intel_async_flip_check_hw() is too long.
>
> BR,
> Jani.
>
>
>>
>> Signed-off-by: Tom Rix <trix@...hat.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_display.c | 14 +++++---------
>>  1 file changed, 5 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>> index 0490c6412ab5..1f852e49fc20 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -5994,8 +5994,7 @@ static int intel_async_flip_check_hw(struct intel_atomic_state *state, struct in
>>  		 * Need to verify this for all gen9 platforms to enable
>>  		 * this selectively if required.
>>  		 */
>> -		switch (new_plane_state->hw.fb->modifier) {
>> -		case DRM_FORMAT_MOD_LINEAR:
>> +		if (new_plane_state->hw.fb->modifier == DRM_FORMAT_MOD_LINEAR) {
>>  			/*
>>  			 * FIXME: Async on Linear buffer is supported on ICL as
>>  			 * but with additional alignment and fbc restrictions
>> @@ -6008,13 +6007,10 @@ static int intel_async_flip_check_hw(struct intel_atomic_state *state, struct in
>>  					    plane->base.base.id, plane->base.name);
>>  				return -EINVAL;
>>  			}
>> -
>> -		case I915_FORMAT_MOD_X_TILED:
>> -		case I915_FORMAT_MOD_Y_TILED:
>> -		case I915_FORMAT_MOD_Yf_TILED:
>> -		case I915_FORMAT_MOD_4_TILED:
>> -			break;
>> -		default:
>> +		} else if (!(new_plane_state->hw.fb->modifier == I915_FORMAT_MOD_X_TILED ||
>> +			     new_plane_state->hw.fb->modifier == I915_FORMAT_MOD_Y_TILED ||
>> +			     new_plane_state->hw.fb->modifier == I915_FORMAT_MOD_Yf_TILED ||
>> +			     new_plane_state->hw.fb->modifier == I915_FORMAT_MOD_4_TILED)) {
>>  			drm_dbg_kms(&i915->drm,
>>  				    "[PLANE:%d:%s] Modifier does not support async flips\n",
>>  				    plane->base.base.id, plane->base.name);

-- 
Jani Nikula, Intel Open Source Graphics Center

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ