[PATCH v1 04/19] mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check

Christophe Kerello christophe.kerello at foss.st.com
Tue Aug 23 00:49:37 PDT 2022


Hi Jack,

On 8/19/22 08:07, Jack Wang wrote:
> dma_map_sg return 0 on error, in case of error return -EIO.
> 
> Cc: Miquel Raynal <miquel.raynal at bootlin.com>
> Cc: Richard Weinberger <richard at nod.at>
> Cc: Vignesh Raghavendra <vigneshr at ti.com>
> Cc: Maxime Coquelin <mcoquelin.stm32 at gmail.com>
> Cc: Alexandre Torgue <alexandre.torgue at foss.st.com>
> Cc: Philipp Zabel <p.zabel at pengutronix.de>
> Cc: Christophe Kerello <christophe.kerello at foss.st.com>
> Cc: Cai Huoqing <cai.huoqing at linux.dev>
> Cc: linux-mtd at lists.infradead.org
> Cc: linux-stm32 at st-md-mailman.stormreply.com
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Jack Wang <jinpu.wang at ionos.com>
> ---
>   drivers/mtd/nand/raw/stm32_fmc2_nand.c | 8 +++++---
>   1 file 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,

Reviewed-by: Christophe Kerello <christophe.kerello at foss.st.com>

Regards,
Christophe Kerello.



More information about the linux-mtd mailing list