mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: daniel.lezcano@linaro.org
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org,
	Li.Xiubo@freescale.com, Arvind Yadav <arvind.yadav.cs@gmail.com>
Subject: [PATCH] clocksource: Freescale: handle of_iomap failures in legacy timer driver
Date: Tue, 30 Aug 2016 22:39:22 +0530	[thread overview]
Message-ID: <1472576962-9826-1-git-send-email-arvind.yadav.cs@gmail.com> (raw)

Check return value of of_iomap and handle errors correctly.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/clocksource/fsl_ftm_timer.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c
index 738515b..c42d159 100644
--- a/drivers/clocksource/fsl_ftm_timer.c
+++ b/drivers/clocksource/fsl_ftm_timer.c
@@ -335,36 +335,40 @@ static int __init ftm_timer_init(struct device_node *np)
 	priv->clksrc_base = of_iomap(np, 1);
 	if (!priv->clksrc_base) {
 		pr_err("ftm: unable to map source timer registers\n");
-		goto err;
+		goto err1;
 	}
 
 	ret = -EINVAL;
 	irq = irq_of_parse_and_map(np, 0);
 	if (irq <= 0) {
 		pr_err("ftm: unable to get IRQ from DT, %d\n", irq);
-		goto err;
+		goto err2;
 	}
 
 	priv->big_endian = of_property_read_bool(np, "big-endian");
 
 	freq = ftm_clk_init(np);
 	if (!freq)
-		goto err;
+		goto err2;
 
 	ret = ftm_calc_closest_round_cyc(freq);
 	if (ret)
-		goto err;
+		goto err2;
 
 	ret = ftm_clocksource_init(freq);
 	if (ret)
-		goto err;
+		goto err2;
 
 	ret = ftm_clockevent_init(freq, irq);
 	if (ret)
-		goto err;
+		goto err2;
 
 	return 0;
 
+err2:
+	iounmap(priv->clksrc_base);
+err1:
+	iounmap(priv->clkevt_base);
 err:
 	kfree(priv);
 	return ret;
-- 
2.7.4

             reply	other threads:[~2016-08-30 17:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-30 17:09 Arvind Yadav [this message]
2016-09-08 11:02 ` Daniel Lezcano
2016-09-08 17:14   ` arvind Yadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472576962-9826-1-git-send-email-arvind.yadav.cs@gmail.com \
    --to=arvind.yadav.cs@gmail.com \
    --cc=Li.Xiubo@freescale.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®