public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org,
	Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Subject: [PATCH 5/5] clocksource/drivers/mips-gic-timer: Fix an error code in 'gic_clocksource_of_init()'
Date: Tue, 27 Jun 2017 11:27:00 +0200	[thread overview]
Message-ID: <1498555620-25094-5-git-send-email-daniel.lezcano@linaro.org> (raw)
In-Reply-To: <1498555620-25094-1-git-send-email-daniel.lezcano@linaro.org>

From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>

'clk' is a valid pointer at this point. So calling PTR_ERR on it is
pointess.

Return the error code from 'clk_prepare_enable()' if it fails instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/mips-gic-timer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c
index e31e083..17b861e 100644
--- a/drivers/clocksource/mips-gic-timer.c
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -167,10 +167,11 @@ static int __init gic_clocksource_of_init(struct device_node *node)
 
 	clk = of_clk_get(node, 0);
 	if (!IS_ERR(clk)) {
-		if (clk_prepare_enable(clk) < 0) {
+		ret = clk_prepare_enable(clk);
+		if (ret < 0) {
 			pr_err("GIC failed to enable clock\n");
 			clk_put(clk);
-			return PTR_ERR(clk);
+			return ret;
 		}
 
 		gic_frequency = clk_get_rate(clk);
-- 
2.7.4

      parent reply	other threads:[~2017-06-27  9:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27  9:22 [GIT PULL] clockevents changes for 4.13 Daniel Lezcano
2017-06-27  9:26 ` [PATCH 1/5] clocksource/drivers/timer-of: Fix invalid iomap check Daniel Lezcano
2017-06-27  9:26   ` [PATCH 2/5] clocksource/drivers/sun4i: Switch to the timer-of common init Daniel Lezcano
2017-06-27  9:26   ` [PATCH 3/5] clocksource/drivers/tcb_clksrc: Make IO endian agnostic Daniel Lezcano
2017-06-27  9:26   ` [PATCH 4/5] clocksource/drivers/fsl_ftm_timer: Unmap region obtained by of_iomap Daniel Lezcano
2017-06-27  9:27   ` Daniel Lezcano [this message]

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=1498555620-25094-5-git-send-email-daniel.lezcano@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --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