public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: fix sign check of an unsigned variable in cpufreq-cpu0
@ 2013-02-25 11:32 Guennadi Liakhovetski
  2013-02-25 12:09 ` Viresh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Guennadi Liakhovetski @ 2013-02-25 11:32 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: cpufreq, linux-kernel

A "< 0" test for an unsigned variable is meaningless, change the variable
to signed.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---

stable?

 drivers/cpufreq/cpufreq-cpu0.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 52bf36d..e7bad3c 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -44,7 +44,8 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
 {
 	struct cpufreq_freqs freqs;
 	struct opp *opp;
-	unsigned long freq_Hz, volt = 0, volt_old = 0, tol = 0;
+	unsigned long volt = 0, volt_old = 0, tol = 0;
+	long freq_Hz;
 	unsigned int index, cpu;
 	int ret;
 
-- 
1.7.2.5


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

* Re: [PATCH] cpufreq: fix sign check of an unsigned variable in cpufreq-cpu0
  2013-02-25 11:32 [PATCH] cpufreq: fix sign check of an unsigned variable in cpufreq-cpu0 Guennadi Liakhovetski
@ 2013-02-25 12:09 ` Viresh Kumar
  2013-02-25 18:42   ` Mike Turquette
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2013-02-25 12:09 UTC (permalink / raw)
  To: Guennadi Liakhovetski, Mike Turquette
  Cc: Rafael J. Wysocki, cpufreq, linux-kernel

On Mon, Feb 25, 2013 at 5:02 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> A "< 0" test for an unsigned variable is meaningless, change the variable
> to signed.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>
> stable?
>
>  drivers/cpufreq/cpufreq-cpu0.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> index 52bf36d..e7bad3c 100644
> --- a/drivers/cpufreq/cpufreq-cpu0.c
> +++ b/drivers/cpufreq/cpufreq-cpu0.c
> @@ -44,7 +44,8 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
>  {
>         struct cpufreq_freqs freqs;
>         struct opp *opp;
> -       unsigned long freq_Hz, volt = 0, volt_old = 0, tol = 0;
> +       unsigned long volt = 0, volt_old = 0, tol = 0;
> +       long freq_Hz;

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

The disease is spread across a bigger region though.

@Mike: clk_round_rate returns long and __clk_round_rate returns unsigned long
and clk_ops->round_rate returns long again.. Don't you see something
strange here?

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

* Re: [PATCH] cpufreq: fix sign check of an unsigned variable in cpufreq-cpu0
  2013-02-25 12:09 ` Viresh Kumar
@ 2013-02-25 18:42   ` Mike Turquette
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Turquette @ 2013-02-25 18:42 UTC (permalink / raw)
  To: Viresh Kumar, Guennadi Liakhovetski
  Cc: Rafael J. Wysocki, cpufreq, linux-kernel

Quoting Viresh Kumar (2013-02-25 04:09:47)
> On Mon, Feb 25, 2013 at 5:02 PM, Guennadi Liakhovetski
> <g.liakhovetski@gmx.de> wrote:
> > A "< 0" test for an unsigned variable is meaningless, change the variable
> > to signed.
> >
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > ---
> >
> > stable?
> >
> >  drivers/cpufreq/cpufreq-cpu0.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
> > index 52bf36d..e7bad3c 100644
> > --- a/drivers/cpufreq/cpufreq-cpu0.c
> > +++ b/drivers/cpufreq/cpufreq-cpu0.c
> > @@ -44,7 +44,8 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
> >  {
> >         struct cpufreq_freqs freqs;
> >         struct opp *opp;
> > -       unsigned long freq_Hz, volt = 0, volt_old = 0, tol = 0;
> > +       unsigned long volt = 0, volt_old = 0, tol = 0;
> > +       long freq_Hz;
> 
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> 
> The disease is spread across a bigger region though.
> 
> @Mike: clk_round_rate returns long and __clk_round_rate returns unsigned long
> and clk_ops->round_rate returns long again.. Don't you see something
> strange here?

Yes, this is in my todo list.  I have a branch with some relevant
changes but I haven't posted it yet.

Regards,
Mike

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

end of thread, other threads:[~2013-02-25 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-25 11:32 [PATCH] cpufreq: fix sign check of an unsigned variable in cpufreq-cpu0 Guennadi Liakhovetski
2013-02-25 12:09 ` Viresh Kumar
2013-02-25 18:42   ` Mike Turquette

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