diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-04-29 20:41:37 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-05-03 14:00:38 +0100 |
commit | 73c1a5153ec8c53100b13bccafbb29cd502ee086 (patch) | |
tree | 10a2ed2dd478d8ee8a0455c5cc2f37ee574c4a72 /drivers | |
parent | 69bb9b29bf67e850beece45e9c99ca707eac7e41 (diff) | |
download | linux-73c1a5153ec8c53100b13bccafbb29cd502ee086.tar.bz2 |
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Chuanhong Guo <gch981213@gmail.com>
Link: https://lore.kernel.org/r/YmwjUcTKyQNrrn2g@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/spi-mtk-snfi.c | 6 |
1 files 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; } |