[PATCH v2 08/18] CLK: Check and do not allow to register clock twice

Andrey Panov rockford at yandex.ru
Wed Mar 4 12:11:36 PST 2015


Signed-off-by: Andrey Panov <rockford at yandex.ru>
---
 drivers/clk/clk.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 584e2f3..b77d022 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -212,6 +212,16 @@ struct clk *clk_get_parent(struct clk *clk)
 
 int clk_register(struct clk *clk)
 {
+	struct clk *c;
+
+	list_for_each_entry(c, &clks, list) {
+		if (!strcmp(c->name, clk->name)) {
+			pr_err("%s clk %s is already registered, skipping!\n",
+				__func__, clk->name);
+			return -EBUSY;
+		}
+	}
+
 	clk->parents = xzalloc(sizeof(struct clk *) * clk->num_parents);
 
 	list_add_tail(&clk->list, &clks);
-- 
2.1.4




More information about the barebox mailing list