diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2014-12-18 10:41:44 +0100 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-01-19 09:56:14 +0100 |
commit | 9116752f51d7cce9b555ea87a7ee78846e315751 (patch) | |
tree | 48edaf2242ceb445fe395e7296a5cfb214bd959d /drivers | |
parent | mmc: sdhci-st: Do cleanup while mmc_of_parse() return an error (diff) | |
download | linux-9116752f51d7cce9b555ea87a7ee78846e315751.tar.xz linux-9116752f51d7cce9b555ea87a7ee78846e315751.zip |
mmc: core: Return error at failure of request CD/WP in mmc_of_parse()
Instead of just printing an error when mmc_of_parse() fails to request
CD/WP GPIO pins, let's propagate all errors, except for -ENOENT.
Earlier only -EPROBE_DEFER was handled correctly.
As a side effect of this change and by relying on host drivers to
handle the errors during ->probe(), we don't need to free any data in
the error path.
This also means we are actually fixing a bug, since we remove the call
to mmc_gpio_free_cd() which wasn't the correct function to invoke to
handle cleanup. Instead that should have been mmc_gpiod_free_cd().
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/core/host.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 270d58a4c43d..45c2daea71ab 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -367,16 +367,10 @@ int mmc_of_parse(struct mmc_host *host) ret = mmc_gpiod_request_cd(host, "cd", 0, true, 0, &cd_gpio_invert); - if (ret) { - if (ret == -EPROBE_DEFER) - return ret; - if (ret != -ENOENT) { - dev_err(host->parent, - "Failed to request CD GPIO: %d\n", - ret); - } - } else + if (!ret) dev_info(host->parent, "Got CD GPIO\n"); + else if (ret != -ENOENT) + return ret; /* * There are two ways to flag that the CD line is inverted: @@ -397,16 +391,10 @@ int mmc_of_parse(struct mmc_host *host) ro_cap_invert = of_property_read_bool(np, "wp-inverted"); ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert); - if (ret) { - if (ret == -EPROBE_DEFER) - goto out; - if (ret != -ENOENT) { - dev_err(host->parent, - "Failed to request WP GPIO: %d\n", - ret); - } - } else + if (!ret) dev_info(host->parent, "Got WP GPIO\n"); + else if (ret != -ENOENT) + return ret; /* See the comment on CD inversion above */ if (ro_cap_invert ^ ro_gpio_invert) @@ -458,10 +446,6 @@ int mmc_of_parse(struct mmc_host *host) } return 0; - -out: - mmc_gpio_free_cd(host); - return ret; } EXPORT_SYMBOL(mmc_of_parse); |