]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ethernet: atl1: Add missing DMA mapping error checks and count errors
authorThomas Fourier <fourier.thomas@gmail.com>
Mon, 7 Jul 2025 19:36:37 +0000 (15:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2025 16:24:59 +0000 (18:24 +0200)
commit568a6afd1d0409c4bf840941a97f746e3a902dda
tree589e92fb49efd0dd4376973e9be5672351497b12
parente2dec6cdb67802fa43c9b72a8770f6065efe617b
ethernet: atl1: Add missing DMA mapping error checks and count errors

[ Upstream commit d72411d20905180cdc452c553be17481b24463d2 ]

The `dma_map_XXX()` functions can fail and must be checked using
`dma_mapping_error()`.  This patch adds proper error handling for all
DMA mapping calls.

In `atl1_alloc_rx_buffers()`, if DMA mapping fails, the buffer is
deallocated and marked accordingly.

In `atl1_tx_map()`, previously mapped buffers are unmapped and the
packet is dropped on failure.

If `atl1_xmit_frame()` drops the packet, increment the tx_error counter.

Fixes: f3cc28c79760 ("Add Attansic L1 ethernet driver.")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Link: https://patch.msgid.link/20250625141629.114984-2-fourier.thomas@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/atheros/atlx/atl1.c