If clk_find() is called with either parameter being NULL, it will fail
even if a match is found for the non-NULL parameter.

According to the comments, it looks like if either is present it must
match.  But due to the ranking system, I think it is better to just
allow a lower-ranking match to succeed rather than not allow any
match.

Signed-off-by: Kevin Hilman <khil...@deeprootsystems.com>
---
 arch/arm/common/clkdev.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c
index 1037bba..b8fcab2 100644
--- a/arch/arm/common/clkdev.c
+++ b/arch/arm/common/clkdev.c
@@ -41,15 +41,13 @@ static struct clk *clk_find(const char *dev_id, const char 
*con_id)
 
        list_for_each_entry(p, &clocks, node) {
                match = 0;
-               if (p->dev_id) {
-                       if (!dev_id || strcmp(p->dev_id, dev_id))
-                               continue;
-                       match += 2;
+               if (p->dev_id && dev_id) {
+                       if (!strcmp(p->dev_id, dev_id))
+                               match += 2;
                }
-               if (p->con_id) {
-                       if (!con_id || strcmp(p->con_id, con_id))
-                               continue;
-                       match += 1;
+               if (p->con_id && con_id) {
+                       if (!strcmp(p->con_id, con_id))
+                               match += 1;
                }
                if (match == 0)
                        continue;
-- 
1.6.1.2


_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to