]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nui: Fix dma_mapping_error() check
authorThomas Fourier <fourier.thomas@gmail.com>
Mon, 30 Jun 2025 08:36:43 +0000 (10:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 14:03:12 +0000 (16:03 +0200)
commit5ea2a10be7d7e8ac959e3f8b094ede8a4dc5fef1
treec268d5ef2af5464c894611d95e23ff4c4752bc4b
parent7a1841c9609377e989ec41c16551309ce79c39e4
nui: Fix dma_mapping_error() check

[ Upstream commit 561aa0e22b70a5e7246b73d62a824b3aef3fc375 ]

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

This patch creates a new function in niu_ops to test if the mapping
failed.  The test is fixed in niu_rbr_add_page(), added in
niu_start_xmit() and the successfully mapped pages are unmaped upon error.

Fixes: ec2deec1f352 ("niu: Fix to check for dma mapping errors.")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/sun/niu.c
drivers/net/ethernet/sun/niu.h