All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>, ulf.hansson@linaro.org
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: sdhci: Handle return value of clk_prepare_enable
Date: Mon, 5 Jun 2017 13:52:54 +0300	[thread overview]
Message-ID: <a952df70-c23d-aaa1-4a7c-9d4f3df3c695@intel.com> (raw)
In-Reply-To: <96cf6861af2a91afd7f836f6abcc4d35aa9bb449.1496658958.git.arvind.yadav.cs@gmail.com>

On 05/06/17 13:48, 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>

It has already been done.  Check the 'next' branch in the mmc tree:
	git git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git

> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c | 40 ++++++++++++++++++++++++++++++--------
>  1 file changed, 32 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 23d8b8a..9ab64e73 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1250,9 +1250,17 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
>  
>  	pltfm_host->clk = imx_data->clk_per;
>  	pltfm_host->clock = clk_get_rate(pltfm_host->clk);
> -	clk_prepare_enable(imx_data->clk_per);
> -	clk_prepare_enable(imx_data->clk_ipg);
> -	clk_prepare_enable(imx_data->clk_ahb);
> +	err = clk_prepare_enable(imx_data->clk_per);
> +	if (err)
> +		goto free_sdhci;
> +
> +	err = clk_prepare_enable(imx_data->clk_ipg);
> +	if (err)
> +		goto free_clk_per;
> +
> +	err = clk_prepare_enable(imx_data->clk_ahb);
> +	if (err)
> +		goto free_clk_ipg;
>  
>  	imx_data->pinctrl = devm_pinctrl_get(&pdev->dev);
>  	if (IS_ERR(imx_data->pinctrl)) {
> @@ -1314,9 +1322,11 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
>  	return 0;
>  
>  disable_clk:
> -	clk_disable_unprepare(imx_data->clk_per);
> -	clk_disable_unprepare(imx_data->clk_ipg);
>  	clk_disable_unprepare(imx_data->clk_ahb);
> +free_clk_ipg:
> +	clk_disable_unprepare(imx_data->clk_ipg);
> +free_clk_per:
> +	clk_disable_unprepare(imx_data->clk_per);
>  free_sdhci:
>  	sdhci_pltfm_free(pdev);
>  	return err;
> @@ -1393,14 +1403,28 @@ static int sdhci_esdhc_runtime_resume(struct device *dev)
>  	struct sdhci_host *host = dev_get_drvdata(dev);
>  	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>  	struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
> +	int ret;
>  
>  	if (!sdhci_sdio_irq_enabled(host)) {
> -		clk_prepare_enable(imx_data->clk_per);
> -		clk_prepare_enable(imx_data->clk_ipg);
> +		ret = clk_prepare_enable(imx_data->clk_per);
> +		if (ret)
> +			return ret;
> +		ret = clk_prepare_enable(imx_data->clk_ipg);
> +		if (ret)
> +			goto free_clk_per;
>  	}
> -	clk_prepare_enable(imx_data->clk_ahb);
> +	ret = clk_prepare_enable(imx_data->clk_ahb);
> +	if (ret)
> +		goto free_clk_ipg;
>  
>  	return sdhci_runtime_resume_host(host);
> +
> +free_clk_ipg:
> +	clk_disable_unprepare(imx_data->clk_ipg);
> +free_clk_per:
> +	clk_disable_unprepare(imx_data->clk_per);
> +	return ret;
> +
>  }
>  #endif
>  
> 

      reply	other threads:[~2017-06-05 10:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-05 10:48 [PATCH] mmc: sdhci: Handle return value of clk_prepare_enable Arvind Yadav
2017-06-05 10:52 ` Adrian Hunter [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=a952df70-c23d-aaa1-4a7c-9d4f3df3c695@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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.