public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: tegra: fix error check in tegra2_clocks.c
@ 2011-03-30 13:59 Nicolas Kaiser
       [not found] ` <20110330155911.6dc0ef63-m0oTu1HmxXpuhsjpcywf5g@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Kaiser @ 2011-03-30 13:59 UTC (permalink / raw)
  To: Colin Cross
  Cc: Erik Gilling, Olof Johansson, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	Russell King, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Checking 'rate < 0' doesn't work because 'rate' is unsigned.

Signed-off-by: Nicolas Kaiser <nikai-bVCNqDZ4lKNeoWH0uzbU5w@public.gmane.org>
---
Untested.

 arch/arm/mach-tegra/tegra2_clocks.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index 6d7c4ee..4459470 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -1362,14 +1362,15 @@ static int tegra_clk_shared_bus_set_rate(struct clk *c, unsigned long rate)
 {
 	unsigned long flags;
 	int ret;
+	long new_rate = rate;
 
-	rate = clk_round_rate(c->parent, rate);
-	if (rate < 0)
-		return rate;
+	new_rate = clk_round_rate(c->parent, new_rate);
+	if (new_rate < 0)
+		return new_rate;
 
 	spin_lock_irqsave(&c->parent->spinlock, flags);
 
-	c->u.shared_bus_user.rate = rate;
+	c->u.shared_bus_user.rate = new_rate;
 	ret = tegra_clk_shared_bus_update(c->parent);
 
 	spin_unlock_irqrestore(&c->parent->spinlock, flags);
-- 
1.7.3.4

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

* Re: [PATCH] arm: tegra: fix error check in tegra2_clocks.c
       [not found] ` <20110330155911.6dc0ef63-m0oTu1HmxXpuhsjpcywf5g@public.gmane.org>
@ 2011-04-01 20:39   ` Colin Cross
  0 siblings, 0 replies; 2+ messages in thread
From: Colin Cross @ 2011-04-01 20:39 UTC (permalink / raw)
  To: Nicolas Kaiser
  Cc: Erik Gilling, Olof Johansson, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	Russell King, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Wed, Mar 30, 2011 at 6:59 AM, Nicolas Kaiser <nikai-bVCNqDZ4lKNeoWH0uzbU5w@public.gmane.org> wrote:
> Checking 'rate < 0' doesn't work because 'rate' is unsigned.
>
> Signed-off-by: Nicolas Kaiser <nikai-bVCNqDZ4lKNeoWH0uzbU5w@public.gmane.org>
> ---
> Untested.
>
>  arch/arm/mach-tegra/tegra2_clocks.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
> index 6d7c4ee..4459470 100644
> --- a/arch/arm/mach-tegra/tegra2_clocks.c
> +++ b/arch/arm/mach-tegra/tegra2_clocks.c
> @@ -1362,14 +1362,15 @@ static int tegra_clk_shared_bus_set_rate(struct clk *c, unsigned long rate)
>  {
>        unsigned long flags;
>        int ret;
> +       long new_rate = rate;
>
> -       rate = clk_round_rate(c->parent, rate);
> -       if (rate < 0)
> -               return rate;
> +       new_rate = clk_round_rate(c->parent, new_rate);
> +       if (new_rate < 0)
> +               return new_rate;
>
>        spin_lock_irqsave(&c->parent->spinlock, flags);
>
> -       c->u.shared_bus_user.rate = rate;
> +       c->u.shared_bus_user.rate = new_rate;
>        ret = tegra_clk_shared_bus_update(c->parent);
>
>        spin_unlock_irqrestore(&c->parent->spinlock, flags);
> --
> 1.7.3.4
>

Acked-by: Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>

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

end of thread, other threads:[~2011-04-01 20:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30 13:59 [PATCH] arm: tegra: fix error check in tegra2_clocks.c Nicolas Kaiser
     [not found] ` <20110330155911.6dc0ef63-m0oTu1HmxXpuhsjpcywf5g@public.gmane.org>
2011-04-01 20:39   ` Colin Cross

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