Commit 0aab3995485b8a994bf29a995a008c9ea4a28054

Authored by Stefan Nilsson XK
Committed by Chris Ball
1 parent ba6a902d9d

mmc: sdio: remember new card RCA when redetecting card

During redetection of a SDIO card, a request for a new card RCA
was submitted to the card, but was then overwritten by the old RCA.
This caused the card to be deselected instead of selected when using
the incorrect RCA.  This bug's been present since the "oldcard"
handling was introduced in 2.6.32.

Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
Reviewed-by: Ulf Hansson <ulf.hansson@stericsson.com>
Reviewed-by: Pawel Wieczorkiewicz <pawel.wieczorkiewicz@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: <stable@kernel.org>
Signed-off-by: Chris Ball <cjb@laptop.org>

Showing 1 changed file with 8 additions and 0 deletions Side-by-side Diff

drivers/mmc/core/sdio.c
... ... @@ -395,6 +395,14 @@
395 395 if (err)
396 396 goto remove;
397 397  
  398 + /*
  399 + * Update oldcard with the new RCA received from the SDIO
  400 + * device -- we're doing this so that it's updated in the
  401 + * "card" struct when oldcard overwrites that later.
  402 + */
  403 + if (oldcard)
  404 + oldcard->rca = card->rca;
  405 +
398 406 mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
399 407 }
400 408