linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: keystone: gate: fix error handling on init
@ 2013-11-20 12:09 Grygorii Strashko
  2013-11-20 14:51 ` Santosh Shilimkar
  0 siblings, 1 reply; 2+ messages in thread
From: Grygorii Strashko @ 2013-11-20 12:09 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/clk/keystone/gate.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/keystone/gate.c b/drivers/clk/keystone/gate.c
index 1f333bc..17a5983 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)
 	data->domain_base = of_iomap(node, i);
 	if (!data->domain_base) {
 		pr_err("%s: domain ioremap failed\n", __func__);
-		iounmap(data->control_base);
-		goto out;
+		goto unmap_ctrl;
 	}
 
 	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)
 	parent_name = of_clk_get_parent_name(node, 0);
 	if (!parent_name) {
 		pr_err("%s: Parent clock not found\n", __func__);
-		goto out;
+		goto unmap_domain;
 	}
 
 	clk = clk_register_psc(NULL, clk_name, parent_name, data, lock);
-	if (clk) {
+	if (!IS_ERR(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 		return;
 	}
 
 	pr_err("%s: error registering clk %s\n", __func__, node->name);
+
+unmap_domain:
+	iounmap(data->domain_base);
+unmap_ctrl:
+	iounmap(data->control_base);
 out:
 	kfree(data);
 	return;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] clk: keystone: gate: fix error handling on init
  2013-11-20 12:09 [PATCH] clk: keystone: gate: fix error handling on init Grygorii Strashko
@ 2013-11-20 14:51 ` Santosh Shilimkar
  0 siblings, 0 replies; 2+ messages in thread
From: Santosh Shilimkar @ 2013-11-20 14:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 20 November 2013 07:09 AM, Grygorii Strashko wrote:
> 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.
> 
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
Looks good. Thanks !!

Mike, If you are ok can you please consider it for fixes ?

Regards,
Santosh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-20 14:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20 12:09 [PATCH] clk: keystone: gate: fix error handling on init Grygorii Strashko
2013-11-20 14:51 ` Santosh Shilimkar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).