Skip to contentSkip to conversation

mmc_spi: add a status check for spi_sync_locked

PATCH Superseded Kangjie Lu 2 participants 2 messages Mar 10, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 mmc_spi: add a status check for spi_sync_locked

In case spi_sync_locked fails, the fix reports the error and returns the error code upstream.

---
 drivers/mmc/host/mmc_spi.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/host/mmc_spi.c +4 -0
index 1b1498805972..32fea585262b 100644
@@ -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 %02x (%d)\n", status, status);
+		return status;
+	}
 
 	if (host->dma_dev) {
 		dma_sync_single_for_cpu(host->dma_dev,
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Kangjie,

Thank you for the patch.

Quoted 13 lines · Kangjie Lu

In case spi_sync_locked fails, the fix reports the error and returns the error code upstream.

---
 drivers/mmc/host/mmc_spi.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/host/mmc_spi.c +0 -0
index 1b1498805972..32fea585262b 100644

drivers/mmc/host/mmc_spi.c mmc_spi_readblock(struct mmc_spi_host *host, struct spi_transfer *t, · line 823

Quoted 5 lines
drivers/mmc/host/mmc_spi.c +2 -0
@@ -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 %02x (%d)\n", status, status);

I don't think you need to print the status in both hex and in decimal forms. %d should be enough, error codes are usually printed in decimal in the kernel. Apart from that,

Quoted 5 lines
drivers/mmc/host/mmc_spi.c +2 -0
+		return status;
+	}
 
 	if (host->dma_dev) {
 		dma_sync_single_for_cpu(host->dma_dev,
Signature · 3 lines
Regards,

Laurent Pinchart