2019-03-11 05:54:23

by Kangjie Lu

[permalink] [raw]
Subject: [PATCH v2] 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.

Signed-off-by: Kangjie Lu <[email protected]>
---
drivers/mmc/host/mmc_spi.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 1b1498805972..a3533935e282 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -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,
--
2.17.1



2019-03-11 08:26:40

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v2] mmc_spi: add a status check for spi_sync_locked

Hi Kangjie,

Thank you for the patch.

On Mon, Mar 11, 2019 at 12:53:33AM -0500, Kangjie Lu wrote:
> In case spi_sync_locked fails, the fix reports the error and
> returns the error code upstream.
>
> Signed-off-by: Kangjie Lu <[email protected]>

Reviewed-by: Laurent Pinchart <[email protected]>

> ---
> drivers/mmc/host/mmc_spi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
> index 1b1498805972..a3533935e282 100644
> --- a/drivers/mmc/host/mmc_spi.c
> +++ b/drivers/mmc/host/mmc_spi.c
> @@ -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,

--
Regards,

Laurent Pinchart

2019-03-18 10:53:46

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v2] mmc_spi: add a status check for spi_sync_locked

On Mon, 11 Mar 2019 at 06:53, Kangjie Lu <[email protected]> wrote:
>
> In case spi_sync_locked fails, the fix reports the error and
> returns the error code upstream.
>
> Signed-off-by: Kangjie Lu <[email protected]>

Applied for next, thanks!

Kind regards
Uffe


> ---
> drivers/mmc/host/mmc_spi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
> index 1b1498805972..a3533935e282 100644
> --- a/drivers/mmc/host/mmc_spi.c
> +++ b/drivers/mmc/host/mmc_spi.c
> @@ -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,
> --
> 2.17.1
>