Browse Source

eth_nxp_enet_qos_mac: test and return early

move the check inside the loop to return early

Signed-off-by: Adib Taraben <theadib@gmail.com>
pull/85540/head
Adib Taraben 5 months ago committed by Fabio Baltieri
parent
commit
8d368ff4bc
  1. 11
      drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c

11
drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c

@ -73,14 +73,15 @@ static int eth_nxp_enet_qos_tx(const struct device *dev, struct net_pkt *pkt) @@ -73,14 +73,15 @@ static int eth_nxp_enet_qos_tx(const struct device *dev, struct net_pkt *pkt)
frags_count++;
total_bytes += fragment->len;
fragment = fragment->frags;
}
if (total_bytes > config->hw_info.max_frame_len ||
frags_count > NUM_TX_BUFDESC) {
LOG_ERR("TX packet too large");
return -E2BIG;
if (total_bytes > config->hw_info.max_frame_len ||
frags_count > NUM_TX_BUFDESC) {
LOG_ERR("TX packet too large");
return -E2BIG;
}
}
/* One TX at a time in the current implementation */
k_sem_take(&data->tx.tx_sem, K_FOREVER);

Loading…
Cancel
Save