Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1673805

[PATCH] clocksource/mips-gic-timer: Fix an error code in 'gic_clocksource_of_init()'

Path csiph.com!news.freedyn.net!open-news-network.org!aioe.org!bofh.it!news.nic.it!robomod
From Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Newsgroups linux.kernel
Subject [PATCH] clocksource/mips-gic-timer: Fix an error code in 'gic_clocksource_of_init()'
Date Fri, 23 Jun 2017 22:00:01 +0200
Message-ID <tVCUh-6pP-1@gated-at.bofh.it> (permalink)
X-Me-Helo localhost.localdomain
X-Me-Auth Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI=
X-Me-Date Fri, 23 Jun 2017 21:55:16 +0200
X-Me-IP 92.140.158.134
X-Mailer git-send-email 2.11.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 31
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>
X-Original-Date Fri, 23 Jun 2017 21:55:10 +0200
X-Original-Message-ID <20170623195510.12067-1-christophe.jaillet@wanadoo.fr>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1673805

Show key headers only | View raw


'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>
---
Not compile tested as I don't have the corresponding cross-compiler
---
 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 e31e08326024..17b861ea2626 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.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] clocksource/mips-gic-timer: Fix an error code in 'gic_clocksource_of_init()' Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-06-23 22:00 +0200
  Re: [PATCH] clocksource/mips-gic-timer: Fix an error code in  'gic_clocksource_of_init()' Daniel Lezcano <daniel.lezcano@linaro.org> - 2017-06-23 23:00 +0200

csiph-web