[PATCH v2 2/2] spi: airoha: do not keep {tx,rx} dma buffer always mapped
Andy Shevchenko
andy at kernel.org
Fri Sep 20 07:17:14 PDT 2024
On Thu, Sep 19, 2024 at 06:57:17PM +0200, Lorenzo Bianconi wrote:
> DMA map txrx_buf on demand in airoha_snand_dirmap_read and
> airoha_snand_dirmap_write routines and do not keep it always mapped.
> This patch is not fixing any bug or introducing any functional change
> to the driver, it just simplifies the code and improve code readability
> without introducing any performance degradation according to the results
> obtained from the mtd_speedtest kernel module test.
...
> + dma_addr = dma_map_single(as_ctrl->dev, txrx_buf, SPI_NAND_CACHE_SIZE,
> + DMA_FROM_DEVICE);
> + if (dma_mapping_error(as_ctrl->dev, dma_addr))
> + return -ENOMEM;
Shouldn't this be
err = dma_mapping_error(as_ctrl->dev, dma_addr);
if (err)
return err;
?
...
> + dma_addr = dma_map_single(as_ctrl->dev, txrx_buf, SPI_NAND_CACHE_SIZE,
> + DMA_TO_DEVICE);
> + if (dma_mapping_error(as_ctrl->dev, dma_addr))
> + return -ENOMEM;
Ditto.
--
With Best Regards,
Andy Shevchenko
More information about the linux-arm-kernel
mailing list