From: viresh kumar <viresh.linux@gmail.com>
Date: Tue, 9 Mar 2010 10:54:30 +0000 (+0100)
Subject: ARM: 5979/1: CLKDEV: return from clk_find as soon as we get maching clk
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e4bf5becccf4685754c4d8e4485bb2ff7d28147f;p=linux.git

ARM: 5979/1: CLKDEV: return from clk_find as soon as we get maching clk

clk_find function looks for clock with matching dev_id and con_id.
We should return from clk_find as soon as we get a clock with matching
dev_id and con_id. This can be done by comparing variable "match" with 3.

Acked-by: Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---

diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c
index 6416d5b5020d2..4f8390dd6cac1 100644
--- a/arch/arm/common/clkdev.c
+++ b/arch/arm/common/clkdev.c
@@ -52,12 +52,13 @@ static struct clk *clk_find(const char *dev_id, const char *con_id)
 				continue;
 			match += 1;
 		}
-		if (match == 0)
-			continue;
 
 		if (match > best) {
 			clk = p->clk;
-			best = match;
+			if (match != 3)
+				best = match;
+			else
+				break;
 		}
 	}
 	return clk;