diff options
author | Chen-Yu Tsai <wens@csie.org> | 2016-05-29 03:04:42 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2016-06-02 04:39:05 -0400 |
commit | f741494363c6c90e6744117d2771bbdf0fb3c455 (patch) | |
tree | 631a6a08eebc95f150c797a44ea4714c7c6ea57e | |
parent | 1a695a905c18548062509178b98bc91e67510864 (diff) |
mmc: fix mmc mode selection for HS-DDR and higher
When IS_ERR_VALUE was removed from the mmc core code, it was replaced
with a simple not-zero check. This does not work, as the value checked
is the return value for mmc_select_bus_width, which returns the set
bit width on success. This made eMMC modes higher than HS-DDR unusable.
Fix this by checking for a positive return value instead.
Fixes: 287980e49ffc ("remove lots of IS_ERR_VALUE abuses")
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/core/mmc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index c984321d1881..5d438ad3ee32 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card *card) | |||
1276 | * switch to HS200 mode if bus width is set successfully. | 1276 | * switch to HS200 mode if bus width is set successfully. |
1277 | */ | 1277 | */ |
1278 | err = mmc_select_bus_width(card); | 1278 | err = mmc_select_bus_width(card); |
1279 | if (!err) { | 1279 | if (err >= 0) { |
1280 | val = EXT_CSD_TIMING_HS200 | | 1280 | val = EXT_CSD_TIMING_HS200 | |
1281 | card->drive_strength << EXT_CSD_DRV_STR_SHIFT; | 1281 | card->drive_strength << EXT_CSD_DRV_STR_SHIFT; |
1282 | err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 1282 | err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
@@ -1583,7 +1583,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1583 | } else if (mmc_card_hs(card)) { | 1583 | } else if (mmc_card_hs(card)) { |
1584 | /* Select the desired bus width optionally */ | 1584 | /* Select the desired bus width optionally */ |
1585 | err = mmc_select_bus_width(card); | 1585 | err = mmc_select_bus_width(card); |
1586 | if (!err) { | 1586 | if (err >= 0) { |
1587 | err = mmc_select_hs_ddr(card); | 1587 | err = mmc_select_hs_ddr(card); |
1588 | if (err) | 1588 | if (err) |
1589 | goto free_card; | 1589 | goto free_card; |