public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: tegra: fix return value check in tegra_clk_register_pllc()
@ 2013-10-29  2:07 Wei Yongjun
       [not found] ` <CAPgLHd-wYa3Z7J93LmC0rvRPKsrjK+8DEZR+2f+e14RN+p_fPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2013-10-29  2:07 UTC (permalink / raw)
  To: mturquette-QSEj5FYQhm4dnm+yROfE0A, swarren-3lzwWm7+Weoh9ZMKESR00Q,
	pdeschrijver-DDmLM1+adcrQT0dZR+AlfA,
	pgaikwad-DDmLM1+adcrQT0dZR+AlfA
  Cc: yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>

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

Signed-off-by: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
---
 drivers/clk/tegra/clk-pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c
index 197074a..a99bef7 100644
--- a/drivers/clk/tegra/clk-pll.c
+++ b/drivers/clk/tegra/clk-pll.c
@@ -1507,7 +1507,7 @@ struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name,
 		return ERR_PTR(-EINVAL);
 
 	parent = __clk_lookup(parent_name);
-	if (IS_ERR(parent)) {
+	if (!parent) {
 		WARN(1, "parent clk %s of %s must be registered first\n",
 			name, parent_name);
 		return ERR_PTR(-EINVAL);

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

* Re: [PATCH] clk: tegra: fix return value check in tegra_clk_register_pllc()
       [not found] ` <CAPgLHd-wYa3Z7J93LmC0rvRPKsrjK+8DEZR+2f+e14RN+p_fPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-10-29 19:40   ` Stephen Warren
  2013-11-28 13:10   ` Peter De Schrijver
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2013-10-29 19:40 UTC (permalink / raw)
  To: Wei Yongjun, mturquette-QSEj5FYQhm4dnm+yROfE0A,
	pdeschrijver-DDmLM1+adcrQT0dZR+AlfA,
	pgaikwad-DDmLM1+adcrQT0dZR+AlfA
  Cc: yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On 10/28/2013 08:07 PM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
> 
> In case of error, the function __clk_lookup() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should
> be replaced with NULL test.

>  	parent = __clk_lookup(parent_name);
> -	if (IS_ERR(parent)) {
> +	if (!parent) {

clk_get() returns an error-value. It'd be nice if the internal clk APIs
all did the same for consistency... Otherwise, the clock subsystem is
essentially using both NULL and error-values as errors, which is rather
frowned upon.

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

* Re: [PATCH] clk: tegra: fix return value check in tegra_clk_register_pllc()
       [not found] ` <CAPgLHd-wYa3Z7J93LmC0rvRPKsrjK+8DEZR+2f+e14RN+p_fPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2013-10-29 19:40   ` Stephen Warren
@ 2013-11-28 13:10   ` Peter De Schrijver
  1 sibling, 0 replies; 3+ messages in thread
From: Peter De Schrijver @ 2013-11-28 13:10 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org, Prashant Gaikwad,
	yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, Oct 29, 2013 at 03:07:57AM +0100, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
> 
> In case of error, the function __clk_lookup() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should
> be replaced with NULL test.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
> ---
>  drivers/clk/tegra/clk-pll.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c
> index 197074a..a99bef7 100644
> --- a/drivers/clk/tegra/clk-pll.c
> +++ b/drivers/clk/tegra/clk-pll.c
> @@ -1507,7 +1507,7 @@ struct clk *tegra_clk_register_pllc(const char *name, const char *parent_name,
>  		return ERR_PTR(-EINVAL);
>  
>  	parent = __clk_lookup(parent_name);
> -	if (IS_ERR(parent)) {
> +	if (!parent) {
>  		WARN(1, "parent clk %s of %s must be registered first\n",
>  			name, parent_name);
>  		return ERR_PTR(-EINVAL);
> 

Ah :( There are a few more instances of this. I will fix them all.

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

end of thread, other threads:[~2013-11-28 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-29  2:07 [PATCH] clk: tegra: fix return value check in tegra_clk_register_pllc() Wei Yongjun
     [not found] ` <CAPgLHd-wYa3Z7J93LmC0rvRPKsrjK+8DEZR+2f+e14RN+p_fPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-10-29 19:40   ` Stephen Warren
2013-11-28 13:10   ` Peter De Schrijver

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