diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-05-13 08:18:03 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-05-13 08:18:05 +0200 |
commit | 284a1657e6ef1f2af43d34a01c503b7ac595c599 (patch) | |
tree | 6e716d200d400dd467a85f4be948c5a8180760b9 /drivers/mci | |
parent | 320ae02a3a2ae639d6bb98d2cb528924547bb52d (diff) | |
download | barebox-284a1657e6ef1f2af43d34a01c503b7ac595c599.tar.gz barebox-284a1657e6ef1f2af43d34a01c503b7ac595c599.tar.xz |
mci: imx-esdhc: Check for errors in esdhc_pio_read_write
esdhc_pio_read_write can fail, so let it return an error code
rather than void.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mci')
-rw-r--r-- | drivers/mci/imx-esdhc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c index 178967ae27..f31021351c 100644 --- a/drivers/mci/imx-esdhc.c +++ b/drivers/mci/imx-esdhc.c @@ -93,7 +93,7 @@ static u32 esdhc_xfertyp(struct mci_cmd *cmd, struct mci_data *data) /* * PIO Read/Write Mode reduce the performace as DMA is not used in this mode. */ -static void +static int esdhc_pio_read_write(struct mci_host *mci, struct mci_data *data) { struct fsl_esdhc_host *host = to_fsl_esdhc(mci); @@ -116,7 +116,7 @@ esdhc_pio_read_write(struct mci_host *mci, struct mci_data *data) && --timeout); if (timeout <= 0) { printf("\nData Read Failed in PIO Mode."); - return; + return -ETIMEDOUT; } while (size && (!(irqstat & IRQSTAT_TC))) { udelay(100); /* Wait before last byte transfer complete */ @@ -139,7 +139,7 @@ esdhc_pio_read_write(struct mci_host *mci, struct mci_data *data) && --timeout); if (timeout <= 0) { printf("\nData Write Failed in PIO Mode."); - return; + return -ETIMEDOUT; } while (size && (!(irqstat & IRQSTAT_TC))) { udelay(100); /* Wait before last byte transfer complete */ @@ -152,6 +152,8 @@ esdhc_pio_read_write(struct mci_host *mci, struct mci_data *data) blocks--; } } + + return 0; } static int esdhc_setup_data(struct mci_host *mci, struct mci_data *data) @@ -206,10 +208,8 @@ static int esdhc_do_data(struct mci_host *mci, struct mci_data *data) unsigned int num_bytes = data->blocks * data->blocksize; u32 irqstat; - if (IS_ENABLED(CONFIG_MCI_IMX_ESDHC_PIO)) { - esdhc_pio_read_write(mci, data); - return 0; - } + if (IS_ENABLED(CONFIG_MCI_IMX_ESDHC_PIO)) + return esdhc_pio_read_write(mci, data); do { irqstat = esdhc_read32(regs + SDHCI_INT_STATUS); |