aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Wang <[email protected]>2022-08-19 08:07:46 +0200
committerMiquel Raynal <[email protected]>2022-09-21 10:38:46 +0200
commit43b81c2a3e6e07915151045aa13a6e8a9bd64419 (patch)
tree90b9d66ef1a2e01e402ed10d7cb2a979b4cbbede
parentddfa68d415c749390e6a89f760b5edfa2774ad7b (diff)
mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check
dma_map_sg return 0 on error, in case of error return -EIO. Cc: Miquel Raynal <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Vignesh Raghavendra <[email protected]> Cc: Maxime Coquelin <[email protected]> Cc: Alexandre Torgue <[email protected]> Cc: Philipp Zabel <[email protected]> Cc: Christophe Kerello <[email protected]> Cc: Cai Huoqing <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Jack Wang <[email protected]> Reviewed-by: Christophe Kerello <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
-rw-r--r--drivers/mtd/nand/raw/stm32_fmc2_nand.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
index 87c1c7dd97eb..a0c825af19fa 100644
--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
@@ -862,8 +862,8 @@ static int stm32_fmc2_nfc_xfer(struct nand_chip *chip, const u8 *buf,
ret = dma_map_sg(nfc->dev, nfc->dma_data_sg.sgl,
eccsteps, dma_data_dir);
- if (ret < 0)
- return ret;
+ if (!ret)
+ return -EIO;
desc_data = dmaengine_prep_slave_sg(dma_ch, nfc->dma_data_sg.sgl,
eccsteps, dma_transfer_dir,
@@ -893,8 +893,10 @@ static int stm32_fmc2_nfc_xfer(struct nand_chip *chip, const u8 *buf,
ret = dma_map_sg(nfc->dev, nfc->dma_ecc_sg.sgl,
eccsteps, dma_data_dir);
- if (ret < 0)
+ if (!ret) {
+ ret = -EIO;
goto err_unmap_data;
+ }
desc_ecc = dmaengine_prep_slave_sg(nfc->dma_ecc_ch,
nfc->dma_ecc_sg.sgl,