Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

octeontx2: Fix otx2_dma_map_page() error return code

0 is a valid DMA address [1] so using it as the error value can lead to
errors. The error value of dma_map_XXX() functions is DMA_MAPPING_ERROR
which is ~0. The callers of otx2_dma_map_page() use dma_mapping_error()
to test the return value of otx2_dma_map_page(). This means that they
would not detect an error in otx2_dma_map_page().

Make otx2_dma_map_page() return the raw value of dma_map_page_attrs().

[1] https://lore.kernel.org/all/f977f68b-cec5-4ab7-b4bd-2cf6aca46267@intel.com

Fixes: caa2da34fd25 ("octeontx2-pf: Initialize and config queues")
Cc: <stable@vger.kernel.org>
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Link: https://patch.msgid.link/20260114123107.42387-2-fourier.thomas@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Thomas Fourier and committed by
Jakub Kicinski
d998b0e5 a80c9d94

+1 -6
+1 -6
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
··· 940 940 size_t offset, size_t size, 941 941 enum dma_data_direction dir) 942 942 { 943 - dma_addr_t iova; 944 - 945 - iova = dma_map_page_attrs(pfvf->dev, page, 943 + return dma_map_page_attrs(pfvf->dev, page, 946 944 offset, size, dir, DMA_ATTR_SKIP_CPU_SYNC); 947 - if (unlikely(dma_mapping_error(pfvf->dev, iova))) 948 - return (dma_addr_t)NULL; 949 - return iova; 950 945 } 951 946 952 947 static inline void otx2_dma_unmap_page(struct otx2_nic *pfvf,