2023-11-22 08:53:04

by Jiapeng Chong

[permalink] [raw]
Subject: [PATCH] drm/i915/psr: Fix unsigned expression compared with zero

The entry_setup_frames is defined as u8 type, else(entry_setup_frames < 0)
is invalid. At the same time, the return value of function
intel_psr_entry_setup_frames is also of type int. so modified
its type to int.

./drivers/gpu/drm/i915/display/intel_psr.c:1336:5-23: WARNING: Unsigned expression compared with zero: entry_setup_frames >= 0.

Reported-by: Abaci Robot <[email protected]>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7610
Signed-off-by: Jiapeng Chong <[email protected]>
---
drivers/gpu/drm/i915/display/intel_psr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 8d180132a74b..204da50e3f28 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1319,7 +1319,7 @@ static bool _psr_compute_config(struct intel_dp *intel_dp,
{
struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
- u8 entry_setup_frames;
+ int entry_setup_frames;

/*
* Current PSR panels don't work reliably with VRR enabled
--
2.20.1.7.g153144c


2023-11-22 09:16:54

by Jani Nikula

[permalink] [raw]
Subject: Re: [PATCH] drm/i915/psr: Fix unsigned expression compared with zero

On Wed, 22 Nov 2023, Jiapeng Chong <[email protected]> wrote:
> The entry_setup_frames is defined as u8 type, else(entry_setup_frames < 0)
> is invalid. At the same time, the return value of function
> intel_psr_entry_setup_frames is also of type int. so modified
> its type to int.
>
> ./drivers/gpu/drm/i915/display/intel_psr.c:1336:5-23: WARNING: Unsigned expression compared with zero: entry_setup_frames >= 0.
>
> Reported-by: Abaci Robot <[email protected]>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7610
> Signed-off-by: Jiapeng Chong <[email protected]>

There's already a patch. Mika, please follow up with it.

https://patchwork.freedesktop.org/patch/msgid/[email protected]

> ---
> drivers/gpu/drm/i915/display/intel_psr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
> index 8d180132a74b..204da50e3f28 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1319,7 +1319,7 @@ static bool _psr_compute_config(struct intel_dp *intel_dp,
> {
> struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
> - u8 entry_setup_frames;
> + int entry_setup_frames;
>
> /*
> * Current PSR panels don't work reliably with VRR enabled

--
Jani Nikula, Intel

2023-11-23 07:07:23

by Kahola, Mika

[permalink] [raw]
Subject: RE: [PATCH] drm/i915/psr: Fix unsigned expression compared with zero

> -----Original Message-----
> From: Jani Nikula <[email protected]>
> Sent: Wednesday, November 22, 2023 11:15 AM
> To: Jiapeng Chong <[email protected]>
> Cc: [email protected]; Vivi, Rodrigo <[email protected]>; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected]; [email protected]; Jiapeng Chong
> <[email protected]>; Abaci Robot <[email protected]>; Kahola, Mika <[email protected]>
> Subject: Re: [PATCH] drm/i915/psr: Fix unsigned expression compared with zero
>
> On Wed, 22 Nov 2023, Jiapeng Chong <[email protected]> wrote:
> > The entry_setup_frames is defined as u8 type, else(entry_setup_frames
> > < 0) is invalid. At the same time, the return value of function
> > intel_psr_entry_setup_frames is also of type int. so modified its type
> > to int.
> >
> > ./drivers/gpu/drm/i915/display/intel_psr.c:1336:5-23: WARNING: Unsigned expression compared with zero:
> entry_setup_frames >= 0.
> >
> > Reported-by: Abaci Robot <[email protected]>
> > Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7610
> > Signed-off-by: Jiapeng Chong <[email protected]>
>
> There's already a patch. Mika, please follow up with it.
>
> https://patchwork.freedesktop.org/patch/msgid/[email protected]

The patch is now merged. Thanks for the review.

-Mika-
>
> > ---
> > drivers/gpu/drm/i915/display/intel_psr.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> > b/drivers/gpu/drm/i915/display/intel_psr.c
> > index 8d180132a74b..204da50e3f28 100644
> > --- a/drivers/gpu/drm/i915/display/intel_psr.c
> > +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> > @@ -1319,7 +1319,7 @@ static bool _psr_compute_config(struct intel_dp
> > *intel_dp, {
> > struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> > const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
> > - u8 entry_setup_frames;
> > + int entry_setup_frames;
> >
> > /*
> > * Current PSR panels don't work reliably with VRR enabled
>
> --
> Jani Nikula, Intel