* [PATCH v1 04/19] mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check [not found] <20220819060801.10443-1-jinpu.wang@ionos.com> @ 2022-08-19 6:07 ` Jack Wang 2022-08-23 7:49 ` Christophe Kerello 2022-09-20 8:34 ` Miquel Raynal 2022-08-19 6:07 ` [PATCH v1 05/19] mtd: rawnand: marvell: Fix error handle regarding dma_map_sg Jack Wang 1 sibling, 2 replies; 5+ messages in thread From: Jack Wang @ 2022-08-19 6:07 UTC (permalink / raw) To: linux-kernel Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Maxime Coquelin, Alexandre Torgue, Philipp Zabel, Christophe Kerello, Cai Huoqing, linux-mtd, linux-stm32, linux-arm-kernel dma_map_sg return 0 on error, in case of error return -EIO. Cc: Miquel Raynal <miquel.raynal@bootlin.com> Cc: Richard Weinberger <richard@nod.at> Cc: Vignesh Raghavendra <vigneshr@ti.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Christophe Kerello <christophe.kerello@foss.st.com> Cc: Cai Huoqing <cai.huoqing@linux.dev> Cc: linux-mtd@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jack Wang <jinpu.wang@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, -- 2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 04/19] mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check 2022-08-19 6:07 ` [PATCH v1 04/19] mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check Jack Wang @ 2022-08-23 7:49 ` Christophe Kerello 2022-09-20 8:34 ` Miquel Raynal 1 sibling, 0 replies; 5+ messages in thread From: Christophe Kerello @ 2022-08-23 7:49 UTC (permalink / raw) To: Jack Wang, linux-kernel Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Maxime Coquelin, Alexandre Torgue, Philipp Zabel, Cai Huoqing, linux-mtd, linux-stm32, linux-arm-kernel 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@bootlin.com> > Cc: Richard Weinberger <richard@nod.at> > Cc: Vignesh Raghavendra <vigneshr@ti.com> > Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> > Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> > Cc: Philipp Zabel <p.zabel@pengutronix.de> > Cc: Christophe Kerello <christophe.kerello@foss.st.com> > Cc: Cai Huoqing <cai.huoqing@linux.dev> > Cc: linux-mtd@lists.infradead.org > Cc: linux-stm32@st-md-mailman.stormreply.com > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Jack Wang <jinpu.wang@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@foss.st.com> Regards, Christophe Kerello. ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 04/19] mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check 2022-08-19 6:07 ` [PATCH v1 04/19] mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check Jack Wang 2022-08-23 7:49 ` Christophe Kerello @ 2022-09-20 8:34 ` Miquel Raynal 1 sibling, 0 replies; 5+ messages in thread From: Miquel Raynal @ 2022-09-20 8:34 UTC (permalink / raw) To: Jack Wang, linux-kernel Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Maxime Coquelin, Alexandre Torgue, Philipp Zabel, Christophe Kerello, Cai Huoqing, linux-mtd, linux-stm32, linux-arm-kernel On Fri, 2022-08-19 at 06:07:46 UTC, Jack Wang wrote: > dma_map_sg return 0 on error, in case of error return -EIO. > > Cc: Miquel Raynal <miquel.raynal@bootlin.com> > Cc: Richard Weinberger <richard@nod.at> > Cc: Vignesh Raghavendra <vigneshr@ti.com> > Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> > Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> > Cc: Philipp Zabel <p.zabel@pengutronix.de> > Cc: Christophe Kerello <christophe.kerello@foss.st.com> > Cc: Cai Huoqing <cai.huoqing@linux.dev> > Cc: linux-mtd@lists.infradead.org > Cc: linux-stm32@st-md-mailman.stormreply.com > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Jack Wang <jinpu.wang@ionos.com> > Reviewed-by: Christophe Kerello <christophe.kerello@foss.st.com> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 05/19] mtd: rawnand: marvell: Fix error handle regarding dma_map_sg [not found] <20220819060801.10443-1-jinpu.wang@ionos.com> 2022-08-19 6:07 ` [PATCH v1 04/19] mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check Jack Wang @ 2022-08-19 6:07 ` Jack Wang 2022-09-20 8:34 ` Miquel Raynal 1 sibling, 1 reply; 5+ messages in thread From: Jack Wang @ 2022-08-19 6:07 UTC (permalink / raw) To: linux-kernel Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Maxime Coquelin, Alexandre Torgue, Philipp Zabel, Christophe Kerello, Cai Huoqing, linux-mtd, linux-stm32, linux-arm-kernel dma_map_sg return 0 on error, in case of error return -EIO, also add the dma_unmap_sg as rollback on the following error. Cc: Miquel Raynal <miquel.raynal@bootlin.com> Cc: Richard Weinberger <richard@nod.at> Cc: Vignesh Raghavendra <vigneshr@ti.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Christophe Kerello <christophe.kerello@foss.st.com> Cc: Cai Huoqing <cai.huoqing@linux.dev> Cc: linux-mtd@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jack Wang <jinpu.wang@ionos.com> --- drivers/mtd/nand/raw/marvell_nand.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c index 2455a581fd70..d9f2f1d0b5ef 100644 --- a/drivers/mtd/nand/raw/marvell_nand.c +++ b/drivers/mtd/nand/raw/marvell_nand.c @@ -865,13 +865,19 @@ static int marvell_nfc_xfer_data_dma(struct marvell_nfc *nfc, marvell_nfc_enable_dma(nfc); /* Prepare the DMA transfer */ sg_init_one(&sg, nfc->dma_buf, dma_len); - dma_map_sg(nfc->dma_chan->device->dev, &sg, 1, direction); + ret = dma_map_sg(nfc->dma_chan->device->dev, &sg, 1, direction); + if (!ret) { + dev_err(nfc->dev, "Could not map DMA S/G list\n"); + return -ENXIO; + } + tx = dmaengine_prep_slave_sg(nfc->dma_chan, &sg, 1, direction == DMA_FROM_DEVICE ? DMA_DEV_TO_MEM : DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); if (!tx) { dev_err(nfc->dev, "Could not prepare DMA S/G list\n"); + dma_unmap_sg(nfc->dma_chan->device->dev, &sg, 1, direction); return -ENXIO; } -- 2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 05/19] mtd: rawnand: marvell: Fix error handle regarding dma_map_sg 2022-08-19 6:07 ` [PATCH v1 05/19] mtd: rawnand: marvell: Fix error handle regarding dma_map_sg Jack Wang @ 2022-09-20 8:34 ` Miquel Raynal 0 siblings, 0 replies; 5+ messages in thread From: Miquel Raynal @ 2022-09-20 8:34 UTC (permalink / raw) To: Jack Wang, linux-kernel Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Maxime Coquelin, Alexandre Torgue, Philipp Zabel, Christophe Kerello, Cai Huoqing, linux-mtd, linux-stm32, linux-arm-kernel On Fri, 2022-08-19 at 06:07:47 UTC, Jack Wang wrote: > dma_map_sg return 0 on error, in case of error return -EIO, > also add the dma_unmap_sg as rollback on the following error. > > Cc: Miquel Raynal <miquel.raynal@bootlin.com> > Cc: Richard Weinberger <richard@nod.at> > Cc: Vignesh Raghavendra <vigneshr@ti.com> > Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> > Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> > Cc: Philipp Zabel <p.zabel@pengutronix.de> > Cc: Christophe Kerello <christophe.kerello@foss.st.com> > Cc: Cai Huoqing <cai.huoqing@linux.dev> > Cc: linux-mtd@lists.infradead.org > Cc: linux-stm32@st-md-mailman.stormreply.com > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > > Signed-off-by: Jack Wang <jinpu.wang@ionos.com> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-20 8:41 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20220819060801.10443-1-jinpu.wang@ionos.com> 2022-08-19 6:07 ` [PATCH v1 04/19] mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check Jack Wang 2022-08-23 7:49 ` Christophe Kerello 2022-09-20 8:34 ` Miquel Raynal 2022-08-19 6:07 ` [PATCH v1 05/19] mtd: rawnand: marvell: Fix error handle regarding dma_map_sg Jack Wang 2022-09-20 8:34 ` Miquel Raynal
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).