public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] clocksource: keystone: Fix return value check in keystone_timer_init()
@ 2014-01-16  8:29 Wei Yongjun
  2014-01-16  9:37 ` Daniel Lezcano
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2014-01-16  8:29 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: yongjun_wei, linux-kernel

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

In case of error, function of_clk_get() returns ERR_PTR()
and never returns NULL. The NULL test in the return value
check should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/clocksource/timer-keystone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-keystone.c b/drivers/clocksource/timer-keystone.c
index cbac8d0..4ca05ec 100644
--- a/drivers/clocksource/timer-keystone.c
+++ b/drivers/clocksource/timer-keystone.c
@@ -168,7 +168,7 @@ static void __init keystone_timer_init(struct device_node *np)
 	}
 
 	clk = of_clk_get(np, 0);
-	if (!clk) {
+	if (IS_ERR(clk)) {
 		pr_err("%s: failed to get clock\n", __func__);
 		iounmap(timer.base);
 		return;


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

* Re: [PATCH -next] clocksource: keystone: Fix return value check in keystone_timer_init()
  2014-01-16  8:29 [PATCH -next] clocksource: keystone: Fix return value check in keystone_timer_init() Wei Yongjun
@ 2014-01-16  9:37 ` Daniel Lezcano
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lezcano @ 2014-01-16  9:37 UTC (permalink / raw)
  To: Wei Yongjun, tglx; +Cc: yongjun_wei, linux-kernel

On 01/16/2014 09:29 AM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> In case of error, function of_clk_get() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value
> check should be replaced with IS_ERR().
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>   drivers/clocksource/timer-keystone.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/timer-keystone.c b/drivers/clocksource/timer-keystone.c
> index cbac8d0..4ca05ec 100644
> --- a/drivers/clocksource/timer-keystone.c
> +++ b/drivers/clocksource/timer-keystone.c
> @@ -168,7 +168,7 @@ static void __init keystone_timer_init(struct device_node *np)
>   	}
>
>   	clk = of_clk_get(np, 0);
> -	if (!clk) {
> +	if (IS_ERR(clk)) {
>   		pr_err("%s: failed to get clock\n", __func__);
>   		iounmap(timer.base);
>   		return;

Good catch. Applied for 3.15.

Thanks for the fix.

   -- Daniel





-- 
  <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


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

end of thread, other threads:[~2014-01-16  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-16  8:29 [PATCH -next] clocksource: keystone: Fix return value check in keystone_timer_init() Wei Yongjun
2014-01-16  9:37 ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox