From: Ulf Hansson Date: Thu, 18 Dec 2014 09:41:44 +0000 (+0100) Subject: mmc: core: Return error at failure of request CD/WP in mmc_of_parse() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9116752f51d7cce9b555ea87a7ee78846e315751;p=linux-beck.git 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 --- 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);