aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrygorii Strashko <grygorii.strashko@ti.com>2013-11-23 16:31:12 -0500
committerSantosh Shilimkar <santosh.shilimkar@ti.com>2013-12-10 11:08:20 -0500
commite0c223ec67a98f70770eec85e625015f5af69f10 (patch)
treede0fd8d079dd75bd719911b9f3fc99b1f04354a6
parentdbb4e67fe7088f963007453ee07e453c4e1fab28 (diff)
clk: keystone: gate: fix error handling on init
This patch fixes Keystone gate control clock driver initialization path: 1) clk_register_psc() returns error code and not a pure pointer, hence its return value need to be checked using IS_ERR(clk) macro. 2) Mapped IO memory isn't unmapped in case of errors, hence fix it. Cc: Mike Turquette <mturquette@linaro.org Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
-rw-r--r--drivers/clk/keystone/gate.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/clk/keystone/gate.c b/drivers/clk/keystone/gate.c
index 1f333bcfc22e..17a598398a53 100644
--- a/drivers/clk/keystone/gate.c
+++ b/drivers/clk/keystone/gate.c
@@ -223,8 +223,7 @@ static void __init of_psc_clk_init(struct device_node *node, spinlock_t *lock)
223 data->domain_base = of_iomap(node, i); 223 data->domain_base = of_iomap(node, i);
224 if (!data->domain_base) { 224 if (!data->domain_base) {
225 pr_err("%s: domain ioremap failed\n", __func__); 225 pr_err("%s: domain ioremap failed\n", __func__);
226 iounmap(data->control_base); 226 goto unmap_ctrl;
227 goto out;
228 } 227 }
229 228
230 of_property_read_u32(node, "domain-id", &data->domain_id); 229 of_property_read_u32(node, "domain-id", &data->domain_id);
@@ -237,16 +236,21 @@ static void __init of_psc_clk_init(struct device_node *node, spinlock_t *lock)
237 parent_name = of_clk_get_parent_name(node, 0); 236 parent_name = of_clk_get_parent_name(node, 0);
238 if (!parent_name) { 237 if (!parent_name) {
239 pr_err("%s: Parent clock not found\n", __func__); 238 pr_err("%s: Parent clock not found\n", __func__);
240 goto out; 239 goto unmap_domain;
241 } 240 }
242 241
243 clk = clk_register_psc(NULL, clk_name, parent_name, data, lock); 242 clk = clk_register_psc(NULL, clk_name, parent_name, data, lock);
244 if (clk) { 243 if (!IS_ERR(clk)) {
245 of_clk_add_provider(node, of_clk_src_simple_get, clk); 244 of_clk_add_provider(node, of_clk_src_simple_get, clk);
246 return; 245 return;
247 } 246 }
248 247
249 pr_err("%s: error registering clk %s\n", __func__, node->name); 248 pr_err("%s: error registering clk %s\n", __func__, node->name);
249
250unmap_domain:
251 iounmap(data->domain_base);
252unmap_ctrl:
253 iounmap(data->control_base);
250out: 254out:
251 kfree(data); 255 kfree(data);
252 return; 256 return;