mmc_spi: add a status check for spi_sync_locked
authorKangjie Lu <kjlu@umn.edu>
Mon, 11 Mar 2019 05:53:33 +0000 (00:53 -0500)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 15 Apr 2019 09:55:54 +0000 (11:55 +0200)
In case spi_sync_locked fails, the fix reports the error and
returns the error code upstream.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/mmc_spi.c

index 1b1498805972c7fdd9ff2640c55424ad7003760b..a3533935e282bf0e4047858d89f3caeef3618250 100644 (file)
@@ -819,6 +819,10 @@ mmc_spi_readblock(struct mmc_spi_host *host, struct spi_transfer *t,
        }
 
        status = spi_sync_locked(spi, &host->m);
+       if (status < 0) {
+               dev_dbg(&spi->dev, "read error %d\n", status);
+               return status;
+       }
 
        if (host->dma_dev) {
                dma_sync_single_for_cpu(host->dma_dev,