aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk-mux.c
diff options
context:
space:
mode:
authorMike Turquette <mturquette@linaro.org>2012-03-26 20:51:03 -0400
committerMike Turquette <mturquette@linaro.org>2012-04-24 19:37:39 -0400
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,
94 u8 clk_mux_flags, spinlock_t *lock) 94 u8 clk_mux_flags, spinlock_t *lock)
95{ 95{
96 struct clk_mux *mux; 96 struct clk_mux *mux;
97 struct clk *clk;
97 98
99 /* allocate the mux */
98 mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL); 100 mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL);
99
100 if (!mux) { 101 if (!mux) {
101 pr_err("%s: could not allocate mux clk\n", __func__); 102 pr_err("%s: could not allocate mux clk\n", __func__);
102 return ERR_PTR(-ENOMEM); 103 return ERR_PTR(-ENOMEM);
@@ -109,6 +110,11 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
109 mux->flags = clk_mux_flags; 110 mux->flags = clk_mux_flags;
110 mux->lock = lock; 111 mux->lock = lock;
111 112
112 return clk_register(dev, name, &clk_mux_ops, &mux->hw, 113 clk = clk_register(dev, name, &clk_mux_ops, &mux->hw,
113 parent_names, num_parents, flags); 114 parent_names, num_parents, flags);
115
116 if (IS_ERR(clk))
117 kfree(mux);
118
119 return clk;
114} 120}