* [PATCH] devfreq_cooling: no need to check state with negative number
@ 2016-08-22 8:08 ` Shawn Lin
2016-08-23 5:08 ` Chanwoo Choi
0 siblings, 1 reply; 3+ messages in thread
From: Shawn Lin @ 2016-08-22 8:08 UTC (permalink / raw)
To: Zhang Rui, Eduardo Valentin; +Cc: linux-pm, Shawn Lin
We could see that state is defined as unsigned type, so it
should never be less than zero. Let' remove this check.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/thermal/devfreq_cooling.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c
index 01f0015..81631b1 100644
--- a/drivers/thermal/devfreq_cooling.c
+++ b/drivers/thermal/devfreq_cooling.c
@@ -312,7 +312,7 @@ static int devfreq_cooling_state2power(struct thermal_cooling_device *cdev,
unsigned long freq;
u32 static_power;
- if (state < 0 || state >= dfc->freq_table_size)
+ if (state >= dfc->freq_table_size)
return -EINVAL;
freq = dfc->freq_table[state];
--
2.3.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] devfreq_cooling: no need to check state with negative number
2016-08-22 8:08 ` [PATCH] devfreq_cooling: no need to check state with negative number Shawn Lin
@ 2016-08-23 5:08 ` Chanwoo Choi
2016-08-24 6:10 ` Zhang Rui
0 siblings, 1 reply; 3+ messages in thread
From: Chanwoo Choi @ 2016-08-23 5:08 UTC (permalink / raw)
To: Shawn Lin, Zhang Rui, Eduardo Valentin; +Cc: linux-pm
Hi,
On 2016년 08월 22일 17:08, Shawn Lin wrote:
> We could see that state is defined as unsigned type, so it
> should never be less than zero. Let' remove this check.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
>
> drivers/thermal/devfreq_cooling.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c
> index 01f0015..81631b1 100644
> --- a/drivers/thermal/devfreq_cooling.c
> +++ b/drivers/thermal/devfreq_cooling.c
> @@ -312,7 +312,7 @@ static int devfreq_cooling_state2power(struct thermal_cooling_device *cdev,
> unsigned long freq;
> u32 static_power;
>
> - if (state < 0 || state >= dfc->freq_table_size)
> + if (state >= dfc->freq_table_size)
> return -EINVAL;
>
> freq = dfc->freq_table[state];
>
As the description, the 'state' variable is unsigned type.
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
--
Best Regards,
Chanwoo Choi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] devfreq_cooling: no need to check state with negative number
2016-08-23 5:08 ` Chanwoo Choi
@ 2016-08-24 6:10 ` Zhang Rui
0 siblings, 0 replies; 3+ messages in thread
From: Zhang Rui @ 2016-08-24 6:10 UTC (permalink / raw)
To: Chanwoo Choi, Shawn Lin, Eduardo Valentin; +Cc: linux-pm
On 二, 2016-08-23 at 14:08 +0900, Chanwoo Choi wrote:
> Hi,
>
> On 2016년 08월 22일 17:08, Shawn Lin wrote:
> >
> > We could see that state is defined as unsigned type, so it
> > should never be less than zero. Let' remove this check.
> >
> > Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> > ---
> >
> > drivers/thermal/devfreq_cooling.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/thermal/devfreq_cooling.c
> > b/drivers/thermal/devfreq_cooling.c
> > index 01f0015..81631b1 100644
> > --- a/drivers/thermal/devfreq_cooling.c
> > +++ b/drivers/thermal/devfreq_cooling.c
> > @@ -312,7 +312,7 @@ static int devfreq_cooling_state2power(struct
> > thermal_cooling_device *cdev,
> > unsigned long freq;
> > u32 static_power;
> >
> > - if (state < 0 || state >= dfc->freq_table_size)
> > + if (state >= dfc->freq_table_size)
> > return -EINVAL;
> >
> > freq = dfc->freq_table[state];
> >
> As the description, the 'state' variable is unsigned type.
>
> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
>
Patch applied.
thanks,
rui
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-24 6:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20160822081333epcas1p1d61dc80a90c8961ac5fca0686bc79b48@epcas1p1.samsung.com>
2016-08-22 8:08 ` [PATCH] devfreq_cooling: no need to check state with negative number Shawn Lin
2016-08-23 5:08 ` Chanwoo Choi
2016-08-24 6:10 ` Zhang Rui
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).