Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1673805 > unrolled thread
| Started by | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| First post | 2017-06-23 22:00 +0200 |
| Last post | 2017-06-23 23:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[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
| From | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| Date | 2017-06-23 22:00 +0200 |
| Subject | [PATCH] clocksource/mips-gic-timer: Fix an error code in 'gic_clocksource_of_init()' |
| Message-ID | <tVCUh-6pP-1@gated-at.bofh.it> |
'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
[toc] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2017-06-23 23:00 +0200 |
| Subject | Re: [PATCH] clocksource/mips-gic-timer: Fix an error code in 'gic_clocksource_of_init()' |
| Message-ID | <tVDQl-6YI-11@gated-at.bofh.it> |
| In reply to | #1673805 |
On 23/06/2017 21:55, Christophe JAILLET wrote:
> '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
The cross compiler mips-linux-gnu- is available on the ubuntu platform.
I gave a try [1] and it compiled without complains.
Thanks for sending this fix.
-- Daniel
[1]
make ARCH=mips CROSS_COMPILE=mips-linux-gnu- KBUILD_OUTPUT=~/build/mips
generic_defconfig
cd ~/build/mips
make ARCH=mips CROSS_COMPILE=mips-linux-gnu- -j 13 vmlinux
> ---
> 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);
>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web