From b29190c3142cea159eb8be47aae6d77f4c2b93ac Mon Sep 17 00:00:00 2001 From: Declan Snyder Date: Fri, 20 Sep 2024 08:35:40 -0500 Subject: [PATCH] drivers: nxp_enet: Fix tx error handling The code path for error handling and timestamping in tx path was meant to be identical in function to old eth_mcux driver, but there is actually a discrepancy causing no error handling for timestamped frames, fix it. Signed-off-by: Declan Snyder --- drivers/ethernet/nxp_enet/eth_nxp_enet.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/ethernet/nxp_enet/eth_nxp_enet.c b/drivers/ethernet/nxp_enet/eth_nxp_enet.c index a92b13f8da91db..255e8d1bd9b057 100644 --- a/drivers/ethernet/nxp_enet/eth_nxp_enet.c +++ b/drivers/ethernet/nxp_enet/eth_nxp_enet.c @@ -224,15 +224,16 @@ static int eth_nxp_enet_tx(const struct device *dev, struct net_pkt *pkt) ret = ENET_SendFrame(data->base, &data->enet_handle, data->tx_frame_buf, total_len, RING_ID, frame_is_timestamped, pkt); - if (ret == kStatus_Success) { + + if (ret != kStatus_Success) { + LOG_ERR("ENET_SendFrame error: %d", ret); + ENET_ReclaimTxDescriptor(data->base, &data->enet_handle, RING_ID); + ret = -EIO; goto exit; } if (frame_is_timestamped) { eth_wait_for_ptp_ts(dev, pkt); - } else { - LOG_ERR("ENET_SendFrame error: %d", ret); - ENET_ReclaimTxDescriptor(data->base, &data->enet_handle, RING_ID); } exit: