[PATCH] arm: tegra: fix error check in tegra2_clocks.c

Subsystems: arm port, the rest

STALE5613d

2 messages, 2 authors, 2011-04-01 · open the first message on its own page

[PATCH] arm: tegra: fix error check in tegra2_clocks.c

From: Nicolas Kaiser <hidden>
Date: 2011-03-30 14:02:33

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

Signed-off-by: Nicolas Kaiser <redacted>
---
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

Re: [PATCH] arm: tegra: fix error check in tegra2_clocks.c

From: Colin Cross <hidden>
Date: 2011-04-01 20:39:32

On Wed, Mar 30, 2011 at 6:59 AM, Nicolas Kaiser [off-list ref] wrote:
quoted hunk
Checking 'rate < 0' doesn't work because 'rate' is unsigned.

Signed-off-by: Nicolas Kaiser <redacted>
---
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 <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help