[PATCH v2 2/2] spi: airoha: do not keep {tx,rx} dma buffer always mapped

Lorenzo Bianconi lorenzo at kernel.org
Fri Sep 20 07:42:24 PDT 2024


On Sep 20, Andy Shevchenko wrote:
> 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
> 
> 

ack, I will fix it in v3.

Rergards,
Lorenzo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20240920/f72d1641/attachment.sig>


More information about the linux-arm-kernel mailing list