linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: devfreq_cooling: remove impossible condition
@ 2016-02-02  7:32 Sudip Mukherjee
  2016-02-17 15:32 ` Punit Agrawal
  0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2016-02-02  7:32 UTC (permalink / raw)
  To: Eduardo Valentin, Zhang Rui; +Cc: linux-kernel, linux-pm, Sudip Mukherjee

state is an unsigned long and can never be less than 0.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 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];
-- 
1.9.1

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

* Re: [PATCH] thermal: devfreq_cooling: remove impossible condition
  2016-02-02  7:32 [PATCH] thermal: devfreq_cooling: remove impossible condition Sudip Mukherjee
@ 2016-02-17 15:32 ` Punit Agrawal
  0 siblings, 0 replies; 2+ messages in thread
From: Punit Agrawal @ 2016-02-17 15:32 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Eduardo Valentin, Zhang Rui, linux-kernel, linux-pm

Sudip Mukherjee <sudipm.mukherjee@gmail.com> writes:

> state is an unsigned long and can never be less than 0.
>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>  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];

Makes sense.

Acked-by: Punit Agrawal <punit.agrawal@arm.com>

Thanks for sending the fix.

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

end of thread, other threads:[~2016-02-17 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-02  7:32 [PATCH] thermal: devfreq_cooling: remove impossible condition Sudip Mukherjee
2016-02-17 15:32 ` Punit Agrawal

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).