All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: Sanjeev Premi <premi@ti.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH] omap3: Check return values for clk_get
Date: Fri, 08 Jan 2010 14:37:58 -0800	[thread overview]
Message-ID: <87ljg8ql2x.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1262974746-5060-1-git-send-email-premi@ti.com> (Sanjeev Premi's message of "Fri\,  8 Jan 2010 23\:49\:05 +0530")

Sanjeev Premi <premi@ti.com> writes:

> This patch checks if clk_get() returned success for
> the clocks used in function omap2_clk_arch_init().
>
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> ---
>  arch/arm/mach-omap2/clock34xx.c |   25 +++++++++++++++++++++++--
>  1 files changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
> index d4217b9..2c2165b 100644
> --- a/arch/arm/mach-omap2/clock34xx.c
> +++ b/arch/arm/mach-omap2/clock34xx.c
> @@ -316,17 +316,38 @@ static int __init omap2_clk_arch_init(void)
>  {
>  	struct clk *osc_sys_ck, *dpll1_ck, *arm_fck, *core_ck;
>  	unsigned long osc_sys_rate;
> +	short err = 0 ;
>  
>  	if (!mpurate)
>  		return -EINVAL;
>  
> -	/* XXX test these for success */
>  	dpll1_ck = clk_get(NULL, "dpll1_ck");
> +	if (dpll1_ck == NULL) {

All of these checks should be of the form

        if (IS_ERR(<clk>))       

instead of NULL pointer checks.

You could also do something more compact like this, which takes
care of the error check and warning print:

        if (WARN(IS_ERR(<clk ptr>), "Failed to get <name>\n"))

> +		err = 1;
> +		pr_err("*** Failed to get dpll1_ck.\n");
> +	}
> +
>  	arm_fck = clk_get(NULL, "arm_fck");
> +	if (arm_fck == NULL) {
> +		err = 1;
> +		pr_err("*** Failed to get arm_fck.\n");
> +	}
> +
>  	core_ck = clk_get(NULL, "core_ck");
> +	if (core_ck == NULL) {
> +		err = 1;
> +		pr_err("*** Failed to get core_ck.\n");
> +	}
> +
>  	osc_sys_ck = clk_get(NULL, "osc_sys_ck");
> +	if (osc_sys_ck == NULL) {
> +		err = 1;
> +		pr_err("*** Failed to get osc_sys_ck.\n");
> +	}
> +
> +	if (err)
> +		return 1;

Minor issue...

Do you want to skip the rest of the init in case of any failure?

It seems like the DPLL1 is the only one that would be a real failure,
the others just affect the clock display.


Kevin

> -	/* REVISIT: not yet ready for 343x */
>  	if (clk_set_rate(dpll1_ck, mpurate))
>  		printk(KERN_ERR "*** Unable to set MPU rate\n");
>  
> -- 
> 1.6.2.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-01-08 22:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-08 18:19 [PATCH] omap3: Check return values for clk_get Sanjeev Premi
2010-01-08 22:37 ` Kevin Hilman [this message]
2010-01-28 14:11   ` Premi, Sanjeev
2010-01-28 15:01     ` Premi, Sanjeev
2010-01-20  1:19 ` Paul Walmsley
2010-01-21 14:35   ` Premi, Sanjeev

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=87ljg8ql2x.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=premi@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.