* Re: [PATCH RESEND] mmc:host:Fix error handling for calls to the function shdci_runtime_pm_get in the file sdhci.c
[not found] <1455114866-27601-1-git-send-email-xerofoify@gmail.com>
@ 2016-02-11 8:06 ` Adrian Hunter
2016-02-11 18:08 ` Valdis.Kletnieks
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Hunter @ 2016-02-11 8:06 UTC (permalink / raw)
To: Nicholas Krause, ulf.hansson
Cc: ludovic.desroches, ivan.ivanov, sbranden, haibo.chen, jszhang,
marex, linux-mmc, linux-kernel
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;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND] mmc:host:Fix error handling for calls to the function shdci_runtime_pm_get in the file sdhci.c
2016-02-11 8:06 ` [PATCH RESEND] mmc:host:Fix error handling for calls to the function shdci_runtime_pm_get in the file sdhci.c Adrian Hunter
@ 2016-02-11 18:08 ` Valdis.Kletnieks
0 siblings, 0 replies; 2+ messages in thread
From: Valdis.Kletnieks @ 2016-02-11 18:08 UTC (permalink / raw)
To: Adrian Hunter
Cc: Nicholas Krause, ulf.hansson, ludovic.desroches, ivan.ivanov,
sbranden, haibo.chen, jszhang, marex, linux-mmc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 586 bytes --]
On Thu, 11 Feb 2016 10:06:04 +0200, Adrian Hunter said:
> On 10/02/16 16:34, Nicholas Krause wrote:
> > This fixes error handling for various function calls to
> 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.
I wonder if Nicholas has a different meaning of the word "fixes".
Seriously Nicholas - you're wasting maintainer resources with all these
broken patches. Please stop doing it.
[-- Attachment #2: Type: application/pgp-signature, Size: 848 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-11 18:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1455114866-27601-1-git-send-email-xerofoify@gmail.com>
2016-02-11 8:06 ` [PATCH RESEND] mmc:host:Fix error handling for calls to the function shdci_runtime_pm_get in the file sdhci.c Adrian Hunter
2016-02-11 18:08 ` Valdis.Kletnieks
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).