mmc: block: fix a bug of error handling in MMC driver
authorKOBAYASHI Yoshitake <yoshitake.kobayashi@toshiba.co.jp>
Sat, 6 Jul 2013 22:35:45 +0000 (07:35 +0900)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 3 Jan 2014 04:33:36 +0000 (04:33 +0000)
commit295efae476b7941e55a0d46ad4f1044d7f7ecbe0
tree66a96b44e4a0144364b13f350077f8c5debbfcf5
parent969a08e9048ddd0d655a19e692673cdb95116ce6
mmc: block: fix a bug of error handling in MMC driver

commit c8760069627ad3b0dbbea170f0c4c58b16e18d3d upstream.

Current MMC driver doesn't handle generic error (bit19 of device
status) in write sequence. As a result, write data gets lost when
generic error occurs. For example, a generic error when updating a
filesystem management information causes a loss of write data and
corrupts the filesystem. In the worst case, the system will never
boot.

This patch includes the following functionality:
  1. To enable error checking for the response of CMD12 and CMD13
     in write command sequence
  2. To retry write sequence when a generic error occurs

Messages are added for v2 to show what occurs.

[Backported to 3.4-stable]

Signed-off-by: KOBAYASHI Yoshitake <yoshitake.kobayashi@toshiba.co.jp>
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/mmc/card/block.c