[ARM] omap: allow double-registering of clocks
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Thu, 22 Jan 2009 16:08:04 +0000 (16:08 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sun, 8 Feb 2009 17:50:12 +0000 (17:50 +0000)
This stops things blowing up if a 'struct clk' to be passed more
than once to clk_register(), which will be required when we decouple
struct clk's from their names.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/plat-omap/clock.c

index df58f5d9a5abaacf623a610bb69d245cf5655b6a..6b3ef2a0b04eafb53de7fc2cf925384f301acf61 100644 (file)
@@ -292,6 +292,12 @@ int clk_register(struct clk *clk)
        if (clk == NULL || IS_ERR(clk))
                return -EINVAL;
 
+       /*
+        * trap out already registered clocks
+        */
+       if (clk->node.next || clk->node.prev)
+               return 0;
+
        mutex_lock(&clocks_mutex);
        list_add(&clk->node, &clocks);
        if (clk->init)