linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: rjw@rjwysocki.net, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] cpufreq: kirkwood-cpufreq:- Handle return value of clk_prepare_enable
Date: Wed, 17 May 2017 12:44:03 +0530	[thread overview]
Message-ID: <20170517071403.GD17481@vireshk-i7> (raw)
In-Reply-To: <1495003835-25828-1-git-send-email-arvind.yadav.cs@gmail.com>

On 17-05-17, 12:20, Arvind Yadav wrote:
> clk_prepare_enable() can fail here and we must check its return value.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/cpufreq/kirkwood-cpufreq.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c
> index 1b9bcd7..c2dd43f 100644
> --- a/drivers/cpufreq/kirkwood-cpufreq.c
> +++ b/drivers/cpufreq/kirkwood-cpufreq.c
> @@ -127,7 +127,12 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
>  		return PTR_ERR(priv.cpu_clk);
>  	}
>  
> -	clk_prepare_enable(priv.cpu_clk);
> +	err = clk_prepare_enable(priv.cpu_clk);
> +	if (err) {
> +		dev_err(priv.dev, "Unable to prepare cpuclk\n");
> +		return err;
> +	}
> +
>  	kirkwood_freq_table[0].frequency = clk_get_rate(priv.cpu_clk) / 1000;
>  
>  	priv.ddr_clk = of_clk_get_by_name(np, "ddrclk");
> @@ -137,7 +142,11 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
>  		goto out_cpu;
>  	}
>  
> -	clk_prepare_enable(priv.ddr_clk);
> +	err = clk_prepare_enable(priv.ddr_clk);
> +	if (err) {
> +		dev_err(priv.dev, "Unable to prepare ddrclk\n");
> +		goto out_cpu;
> +	}
>  	kirkwood_freq_table[1].frequency = clk_get_rate(priv.ddr_clk) / 1000;
>  
>  	priv.powersave_clk = of_clk_get_by_name(np, "powersave");
> @@ -146,7 +155,11 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev)
>  		err = PTR_ERR(priv.powersave_clk);
>  		goto out_ddr;
>  	}
> -	clk_prepare_enable(priv.powersave_clk);
> +	err = clk_prepare_enable(priv.powersave_clk);
> +	if (err) {
> +		dev_err(priv.dev, "Unable to prepare powersave clk\n");
> +		goto out_ddr;
> +	}
>  
>  	of_node_put(np);
>  	np = NULL;

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

      reply	other threads:[~2017-05-17  7:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17  6:50 [PATCH v3] cpufreq: kirkwood-cpufreq:- Handle return value of clk_prepare_enable Arvind Yadav
2017-05-17  7:14 ` Viresh Kumar [this message]

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=20170517071403.GD17481@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).