mmc:host:Fix error handling for calls to the function shdci_runtime_pm_get in the file sdhci.c
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Nicholas Krause
This fixes error handling for various function calls to the function
shdci_runtime_pm_getin the filesdhci.cto 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?
Quoted 99 lines
Signed-off-by Nicholas Krause <[email protected]>--- drivers/mmc/host/sdhci.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)drivers/mmc/host/sdhci.c +23
-8@@ -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 ;
Quoted 7 lines · Adrian Hunter
Quoted 1 line · Nicholas Krause
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-EACCESmeans 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.