Skip to contentSkip to conversation

spi: mtk-snfi: preserve dma_mapping_error() error codes

PATCH In review Dan Carpenter 3 participants 3 messages Apr 29, 2022 – May 3, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: mtk-snfi: preserve dma_mapping_error() error codes

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

Fixes 764f1b748164 ("spi: add driver for MTK SPI NAND Flash Interface")
---
 drivers/spi/spi-mtk-snfi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/spi-mtk-snfi.c +4 -2
index 2c556e304673..d66bf9762557 100644
@@ -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;
 	}
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw

Hi!

Quoted 5 lines · Dan Carpenter

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

Fixes 764f1b748164 ("spi: add driver for MTK SPI NAND Flash Interface")

Oops. Thanks for fixing that.

--
Regards,
Chuanhong Guo

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek

maintainer
#2 lore raw
In reply to Dan Carpenter
Quoted 3 lines · Dan Carpenter

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