diff mbox

[RFC,7/8] clk: use strncmp for matching con_id in clk_find

Message ID 1363887347-4686-8-git-send-email-t-kristo@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tero Kristo March 21, 2013, 5:35 p.m. UTC
As clkdev register forces the con_id length down to a maximum of 15
characters and terminating null, replace the internal implementation
of clk_find to use strncmp instead of strcmp. This makes sure that
if a user registers a clkdev with con_id name which gets trimmed,
the same string used in the clk_lookup will still succeed despite
this.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Cc: Mike Turquette <mturquette@linaro.org>
---
 drivers/clk/clkdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 442a313..05b01a1 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -120,7 +120,7 @@  static struct clk_lookup *clk_find(const char *dev_id, const char *con_id)
 			match += 2;
 		}
 		if (p->con_id) {
-			if (!con_id || strcmp(p->con_id, con_id))
+			if (!con_id || strncmp(p->con_id, con_id, 15))
 				continue;
 			match += 1;
 		}