All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Nicholas Krause <xerofoify@gmail.com>, ulf.hansson@linaro.org
Cc: ludovic.desroches@atmel.com, ivan.ivanov@linaro.org,
	sbranden@broadcom.com, haibo.chen@freescale.com,
	jszhang@marvell.com, marex@denx.de, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] mmc:host:Fix error handling for calls to the function shdci_runtime_pm_get in the file sdhci.c
Date: Thu, 11 Feb 2016 10:06:04 +0200	[thread overview]
Message-ID: <56BC40EC.60301@intel.com> (raw)
In-Reply-To: <1455114866-27601-1-git-send-email-xerofoify@gmail.com>

On 10/02/16 16:34, Nicholas Krause wrote:
> This fixes error handling for various function calls to
> the function shdci_runtime_pm_get in the file sdhci.c
> to check if this function call returns a error and if
> this function returns a error depending on if the caller
> function is void return either immediately a blank return
> statement or a the returned error code to the caller if the

pm_runtime_resume() returns 1 if the device's runtime PM status was already
'active', and -EACCES means that 'power.disable_depth' is different from 0
(i.e. runtime pm not enabled), so this does not look coded correctly for
those cases.

Why do you need to check the return value?

> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  drivers/mmc/host/sdhci.c | 31 +++++++++++++++++++++++--------
>  1 file changed, 23 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 1dbe932..c31a0d6 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1342,7 +1342,8 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
>  
>  	host = mmc_priv(mmc);
>  
> -	sdhci_runtime_pm_get(host);
> +	if (sdhci_runtime_pm_get(host))
> +		return;
>  
>  	/* Firstly check card presence */
>  	present = sdhci_do_get_cd(host);
> @@ -1589,7 +1590,8 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>  {
>  	struct sdhci_host *host = mmc_priv(mmc);
>  
> -	sdhci_runtime_pm_get(host);
> +	if (sdhci_runtime_pm_get(host))
> +		return;
>  	sdhci_do_set_ios(host, ios);
>  	sdhci_runtime_pm_put(host);
>  }
> @@ -1619,7 +1621,9 @@ static int sdhci_get_cd(struct mmc_host *mmc)
>  	struct sdhci_host *host = mmc_priv(mmc);
>  	int ret;
>  
> -	sdhci_runtime_pm_get(host);
> +	ret = sdhci_runtime_pm_get(host);
> +	if (ret)
> +		return ret;
>  	ret = sdhci_do_get_cd(host);
>  	sdhci_runtime_pm_put(host);
>  	return ret;
> @@ -1680,7 +1684,9 @@ static int sdhci_get_ro(struct mmc_host *mmc)
>  	struct sdhci_host *host = mmc_priv(mmc);
>  	int ret;
>  
> -	sdhci_runtime_pm_get(host);
> +	ret = sdhci_runtime_pm_get(host);
> +	if (ret)
> +		return ret;
>  	ret = sdhci_do_get_ro(host);
>  	sdhci_runtime_pm_put(host);
>  	return ret;
> @@ -1705,7 +1711,8 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)
>  	struct sdhci_host *host = mmc_priv(mmc);
>  	unsigned long flags;
>  
> -	sdhci_runtime_pm_get(host);
> +	if (sdhci_runtime_pm_get(host))
> +		return;
>  
>  	spin_lock_irqsave(&host->lock, flags);
>  	if (enable)
> @@ -1818,7 +1825,9 @@ static int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,
>  
>  	if (host->version < SDHCI_SPEC_300)
>  		return 0;
> -	sdhci_runtime_pm_get(host);
> +	err = sdhci_runtime_pm_get(host);
> +	if (err)
> +		return err;
>  	err = sdhci_do_start_signal_voltage_switch(host, ios);
>  	sdhci_runtime_pm_put(host);
>  	return err;
> @@ -1828,8 +1837,11 @@ static int sdhci_card_busy(struct mmc_host *mmc)
>  {
>  	struct sdhci_host *host = mmc_priv(mmc);
>  	u32 present_state;
> +	int err;
>  
> -	sdhci_runtime_pm_get(host);
> +	err = sdhci_runtime_pm_get(host);
> +	if (err)
> +		return err;
>  	/* Check whether DAT[3:0] is 0000 */
>  	present_state = sdhci_readl(host, SDHCI_PRESENT_STATE);
>  	sdhci_runtime_pm_put(host);
> @@ -1859,7 +1871,10 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
>  	unsigned int tuning_count = 0;
>  	bool hs400_tuning;
>  
> -	sdhci_runtime_pm_get(host);
> +	err = sdhci_runtime_pm_get(host);
> +	if (err)
> +		return err;
> +
>  	spin_lock_irqsave(&host->lock, flags);
>  
>  	hs400_tuning = host->flags & SDHCI_HS400_TUNING;
> 


       reply	other threads:[~2016-02-11  8:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1455114866-27601-1-git-send-email-xerofoify@gmail.com>
2016-02-11  8:06 ` Adrian Hunter [this message]
2016-02-11 18:08   ` [PATCH RESEND] mmc:host:Fix error handling for calls to the function shdci_runtime_pm_get in the file sdhci.c Valdis.Kletnieks

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=56BC40EC.60301@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=haibo.chen@freescale.com \
    --cc=ivan.ivanov@linaro.org \
    --cc=jszhang@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ludovic.desroches@atmel.com \
    --cc=marex@denx.de \
    --cc=sbranden@broadcom.com \
    --cc=ulf.hansson@linaro.org \
    --cc=xerofoify@gmail.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.