linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: mtk-snfi: preserve dma_mapping_error() error codes
@ 2022-04-29 17:41 Dan Carpenter
  2022-05-02  9:43 ` Chuanhong Guo
  2022-05-03 15:51 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-04-29 17:41 UTC (permalink / raw)
  To: Mark Brown, Chuanhong Guo
  Cc: Matthias Brugger, Chuanhong Guo, linux-spi, linux-mediatek,
	kernel-janitors

Return -ENOMEM of there is a dma mapping error.  Do not return success.

Fixes: 764f1b748164 ("spi: add driver for MTK SPI NAND Flash Interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/spi/spi-mtk-snfi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-mtk-snfi.c b/drivers/spi/spi-mtk-snfi.c
index 2c556e304673..d66bf9762557 100644
--- a/drivers/spi/spi-mtk-snfi.c
+++ b/drivers/spi/spi-mtk-snfi.c
@@ -903,7 +903,8 @@ static int mtk_snand_read_page_cache(struct mtk_snand *snf,
 	nfi_write32(snf, NFI_CON, (snf->nfi_cfg.nsectors << CON_SEC_NUM_S));
 
 	buf_dma = dma_map_single(snf->dev, buf, dma_len, DMA_FROM_DEVICE);
-	if (dma_mapping_error(snf->dev, buf_dma)) {
+	ret = dma_mapping_error(snf->dev, buf_dma);
+	if (ret) {
 		dev_err(snf->dev, "DMA mapping failed.\n");
 		goto cleanup;
 	}
@@ -1092,7 +1093,8 @@ static int mtk_snand_write_page_cache(struct mtk_snand *snf,
 
 	nfi_write32(snf, NFI_CON, (snf->nfi_cfg.nsectors << CON_SEC_NUM_S));
 	buf_dma = dma_map_single(snf->dev, snf->buf, dma_len, DMA_TO_DEVICE);
-	if (dma_mapping_error(snf->dev, buf_dma)) {
+	ret = dma_mapping_error(snf->dev, buf_dma);
+	if (ret) {
 		dev_err(snf->dev, "DMA mapping failed.\n");
 		goto cleanup;
 	}
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] spi: mtk-snfi: preserve dma_mapping_error() error codes
  2022-04-29 17:41 [PATCH] spi: mtk-snfi: preserve dma_mapping_error() error codes Dan Carpenter
@ 2022-05-02  9:43 ` Chuanhong Guo
  2022-05-03 15:51 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Chuanhong Guo @ 2022-05-02  9:43 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mark Brown, Matthias Brugger, linux-spi, linux-mediatek, kernel-janitors

Hi!

On Sat, Apr 30, 2022 at 1:42 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Return -ENOMEM of there is a dma mapping error.  Do not return success.
>
> Fixes: 764f1b748164 ("spi: add driver for MTK SPI NAND Flash Interface")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Oops. Thanks for fixing that.
Reviewed-by: Chuanhong Guo <gch981213@gmail.com>
--
Regards,
Chuanhong Guo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] spi: mtk-snfi: preserve dma_mapping_error() error codes
  2022-04-29 17:41 [PATCH] spi: mtk-snfi: preserve dma_mapping_error() error codes Dan Carpenter
  2022-05-02  9:43 ` Chuanhong Guo
@ 2022-05-03 15:51 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2022-05-03 15:51 UTC (permalink / raw)
  To: dan.carpenter, gch981213
  Cc: linux-mediatek, matthias.bgg, linux-spi, kernel-janitors, gch981213

On Fri, 29 Apr 2022 20:41:37 +0300, Dan Carpenter wrote:
> Return -ENOMEM of there is a dma mapping error.  Do not return success.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: mtk-snfi: preserve dma_mapping_error() error codes
      commit: 73c1a5153ec8c53100b13bccafbb29cd502ee086

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-03 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29 17:41 [PATCH] spi: mtk-snfi: preserve dma_mapping_error() error codes Dan Carpenter
2022-05-02  9:43 ` Chuanhong Guo
2022-05-03 15:51 ` Mark Brown

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).