mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: fix compilation error due to shifting negative value
@ 2023-06-02 10:12 GONG, Ruiqi
  2023-06-02 14:28 ` Hamza Mahfooz
  0 siblings, 1 reply; 2+ messages in thread
From: GONG, Ruiqi @ 2023-06-02 10:12 UTC (permalink / raw)
  To: Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Pan Xinhui, David Airlie, Daniel Vetter
  Cc: amd-gfx, dri-devel, linux-kernel, Wang Weiyang, Xiu Jianfeng, gongruiqi1

Currently compiling linux-next with allmodconfig triggers the following
error:

./drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h: In function ‘dc_fixpt_truncate’:
./drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:528:22: error: left shift of negative value [-Werror=shift-negative-value]
  528 |  arg.value &= (~0LL) << (FIXED31_32_BITS_PER_FRACTIONAL_PART - frac_bits);
      |                      ^~

Use `unsigned long long` instead.

Signed-off-by: GONG, Ruiqi <gongruiqi@huaweicloud.com>
---
 drivers/gpu/drm/amd/display/include/fixed31_32.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/include/fixed31_32.h b/drivers/gpu/drm/amd/display/include/fixed31_32.h
index ece97ae0e826..d4cf7ead1d87 100644
--- a/drivers/gpu/drm/amd/display/include/fixed31_32.h
+++ b/drivers/gpu/drm/amd/display/include/fixed31_32.h
@@ -525,7 +525,7 @@ static inline struct fixed31_32 dc_fixpt_truncate(struct fixed31_32 arg, unsigne
 
 	if (negative)
 		arg.value = -arg.value;
-	arg.value &= (~0LL) << (FIXED31_32_BITS_PER_FRACTIONAL_PART - frac_bits);
+	arg.value &= (~0ULL) << (FIXED31_32_BITS_PER_FRACTIONAL_PART - frac_bits);
 	if (negative)
 		arg.value = -arg.value;
 	return arg;
-- 
2.25.1


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

* Re: [PATCH] drm/amd/display: fix compilation error due to shifting negative value
  2023-06-02 10:12 [PATCH] drm/amd/display: fix compilation error due to shifting negative value GONG, Ruiqi
@ 2023-06-02 14:28 ` Hamza Mahfooz
  0 siblings, 0 replies; 2+ messages in thread
From: Hamza Mahfooz @ 2023-06-02 14:28 UTC (permalink / raw)
  To: GONG, Ruiqi, Harry Wentland, Leo Li, Rodrigo Siqueira,
	Alex Deucher, Pan Xinhui, David Airlie, Daniel Vetter
  Cc: Xiu Jianfeng, linux-kernel, dri-devel, Wang Weiyang, amd-gfx, gongruiqi1

On 6/2/23 06:12, GONG, Ruiqi wrote:
> Currently compiling linux-next with allmodconfig triggers the following
> error:
> 
> ./drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h: In function ‘dc_fixpt_truncate’:
> ./drivers/gpu/drm/amd/amdgpu/../display/include/fixed31_32.h:528:22: error: left shift of negative value [-Werror=shift-negative-value]
>    528 |  arg.value &= (~0LL) << (FIXED31_32_BITS_PER_FRACTIONAL_PART - frac_bits);
>        |                      ^~
> 
> Use `unsigned long long` instead.
> 
> Signed-off-by: GONG, Ruiqi <gongruiqi@huaweicloud.com>

Applied, thanks!

> ---
>   drivers/gpu/drm/amd/display/include/fixed31_32.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/include/fixed31_32.h b/drivers/gpu/drm/amd/display/include/fixed31_32.h
> index ece97ae0e826..d4cf7ead1d87 100644
> --- a/drivers/gpu/drm/amd/display/include/fixed31_32.h
> +++ b/drivers/gpu/drm/amd/display/include/fixed31_32.h
> @@ -525,7 +525,7 @@ static inline struct fixed31_32 dc_fixpt_truncate(struct fixed31_32 arg, unsigne
>   
>   	if (negative)
>   		arg.value = -arg.value;
> -	arg.value &= (~0LL) << (FIXED31_32_BITS_PER_FRACTIONAL_PART - frac_bits);
> +	arg.value &= (~0ULL) << (FIXED31_32_BITS_PER_FRACTIONAL_PART - frac_bits);
>   	if (negative)
>   		arg.value = -arg.value;
>   	return arg;
-- 
Hamza


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

end of thread, other threads:[~2023-06-02 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02 10:12 [PATCH] drm/amd/display: fix compilation error due to shifting negative value GONG, Ruiqi
2023-06-02 14:28 ` Hamza Mahfooz

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

all inboxes | Powered by JetHome®