All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] nui: Fix dma_mapping_error() check
@ 2025-06-27 14:48 Thomas Fourier
  2025-06-27 20:16 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Fourier @ 2025-06-27 14:48 UTC (permalink / raw)
  Cc: Thomas Fourier, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Thomas Gleixner, Ingo Molnar,
	Jonathan Currier, Matthew Wilcox (Oracle), Uwe Kleine-König,
	Shuah Khan, netdev, linux-kernel

dma_map_XXX() functions return as error values DMA_MAPPING_ERROR which
is often ~0. The error value should be tested with dma_mapping_error().

Fixes: ec2deec1f352 ("niu: Fix to check for dma mapping errors.")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 drivers/net/ethernet/sun/niu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index ddca8fc7883e..11ff08373de4 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -3336,7 +3336,7 @@ static int niu_rbr_add_page(struct niu *np, struct rx_ring_info *rp,
 
 	addr = np->ops->map_page(np->device, page, 0,
 				 PAGE_SIZE, DMA_FROM_DEVICE);
-	if (!addr) {
+	if (dma_mapping_error(np->device, addr)) {
 		__free_page(page);
 		return -ENOMEM;
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-27 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 14:48 [PATCH net] nui: Fix dma_mapping_error() check Thomas Fourier
2025-06-27 20:16 ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.