diff mbox series

[-next] thermal: Fix unsigned comparison with less than zero

Message ID 20230106005951.100479-1-yang.lee@linux.alibaba.com (mailing list archive)
State Mainlined, archived
Headers show
Series [-next] thermal: Fix unsigned comparison with less than zero | expand

Commit Message

Yang Li Jan. 6, 2023, 12:59 a.m. UTC
The return value from the call to intel_tcc_get_tjmax() is int, which can 
be a negative error code. However, the return value is being assigned to 
an u32 variable 'tj_max', so making 'tj_max' an int.

Eliminate the following warning:
./drivers/thermal/intel/intel_soc_dts_iosf.c:394:5-11: WARNING: Unsigned expression compared with zero: tj_max < 0

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3637
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/thermal/intel/intel_soc_dts_iosf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zhang, Rui Jan. 6, 2023, 7:03 a.m. UTC | #1
On Fri, 2023-01-06 at 08:59 +0800, Yang Li wrote:
> The return value from the call to intel_tcc_get_tjmax() is int, which
> can 
> be a negative error code. However, the return value is being assigned
> to 
> an u32 variable 'tj_max', so making 'tj_max' an int.
> 
> Eliminate the following warning:
> ./drivers/thermal/intel/intel_soc_dts_iosf.c:394:5-11: WARNING:
> Unsigned expression compared with zero: tj_max < 0
> 
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3637
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

Thanks for catching this issue.

Acked-by: Zhang Rui <rui.zhang@intel.com>

thanks,
rui

> ---
>  drivers/thermal/intel/intel_soc_dts_iosf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c
> b/drivers/thermal/intel/intel_soc_dts_iosf.c
> index 2138693d8afd..8c26f7b2316b 100644
> --- a/drivers/thermal/intel/intel_soc_dts_iosf.c
> +++ b/drivers/thermal/intel/intel_soc_dts_iosf.c
> @@ -380,7 +380,7 @@ struct intel_soc_dts_sensors
> *intel_soc_dts_iosf_init(
>  {
>  	struct intel_soc_dts_sensors *sensors;
>  	bool notification;
> -	u32 tj_max;
> +	int tj_max;
>  	int ret;
>  	int i;
>
Rafael J. Wysocki Jan. 12, 2023, 7:23 p.m. UTC | #2
On Fri, Jan 6, 2023 at 8:03 AM Zhang, Rui <rui.zhang@intel.com> wrote:
>
> On Fri, 2023-01-06 at 08:59 +0800, Yang Li wrote:
> > The return value from the call to intel_tcc_get_tjmax() is int, which
> > can
> > be a negative error code. However, the return value is being assigned
> > to
> > an u32 variable 'tj_max', so making 'tj_max' an int.
> >
> > Eliminate the following warning:
> > ./drivers/thermal/intel/intel_soc_dts_iosf.c:394:5-11: WARNING:
> > Unsigned expression compared with zero: tj_max < 0
> >
> > Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3637
> > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
>
> Thanks for catching this issue.
>
> Acked-by: Zhang Rui <rui.zhang@intel.com>

Applied, thanks!

> > ---
> >  drivers/thermal/intel/intel_soc_dts_iosf.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c
> > b/drivers/thermal/intel/intel_soc_dts_iosf.c
> > index 2138693d8afd..8c26f7b2316b 100644
> > --- a/drivers/thermal/intel/intel_soc_dts_iosf.c
> > +++ b/drivers/thermal/intel/intel_soc_dts_iosf.c
> > @@ -380,7 +380,7 @@ struct intel_soc_dts_sensors
> > *intel_soc_dts_iosf_init(
> >  {
> >       struct intel_soc_dts_sensors *sensors;
> >       bool notification;
> > -     u32 tj_max;
> > +     int tj_max;
> >       int ret;
> >       int i;
> >
diff mbox series

Patch

diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/intel/intel_soc_dts_iosf.c
index 2138693d8afd..8c26f7b2316b 100644
--- a/drivers/thermal/intel/intel_soc_dts_iosf.c
+++ b/drivers/thermal/intel/intel_soc_dts_iosf.c
@@ -380,7 +380,7 @@  struct intel_soc_dts_sensors *intel_soc_dts_iosf_init(
 {
 	struct intel_soc_dts_sensors *sensors;
 	bool notification;
-	u32 tj_max;
+	int tj_max;
 	int ret;
 	int i;