summaryrefslogtreecommitdiff
path: root/drivers/clk/clk-mux.c
diff options
context:
space:
mode:
authorMike Turquette <mturquette@linaro.org>2012-03-26 17:51:03 -0700
committerMike Turquette <mturquette@linaro.org>2012-04-24 16:37:39 -0700
commit27d545915fd49cbe18a3877d82359896e9851efb (patch)
treeca3234eef7925fc068f6f55cd965abe21dfa399c /drivers/clk/clk-mux.c
parentd1302a36a7f1c33d1a8babc6a510e1401a5e5aed (diff)
clk: basic: improve parent_names & return errors
This patch is the basic clk version of 'clk: core: copy parent_names & return error codes'. The registration functions are changed to allow the core code to copy the array of strings and allow platforms to declare those arrays as __initdata. This patch also converts all of the basic clk registration functions to return error codes which better aligns them with the existing clk.h api. Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/clk-mux.c')
-rw-r--r--drivers/clk/clk-mux.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
index bd5e598b9f1e..6e58f11ab81f 100644
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -94,9 +94,10 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
u8 clk_mux_flags, spinlock_t *lock)
{
struct clk_mux *mux;
+ struct clk *clk;
+ /* allocate the mux */
mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL);
-
if (!mux) {
pr_err("%s: could not allocate mux clk\n", __func__);
return ERR_PTR(-ENOMEM);
@@ -109,6 +110,11 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
mux->flags = clk_mux_flags;
mux->lock = lock;
- return clk_register(dev, name, &clk_mux_ops, &mux->hw,
+ clk = clk_register(dev, name, &clk_mux_ops, &mux->hw,
parent_names, num_parents, flags);
+
+ if (IS_ERR(clk))
+ kfree(mux);
+
+ return clk;
}