Skip to content

Commit 8d368ff

Browse files
theadibfabiobaltieri
authored andcommitted
eth_nxp_enet_qos_mac: test and return early
move the check inside the loop to return early Signed-off-by: Adib Taraben <[email protected]>
1 parent 1fd9222 commit 8d368ff

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/ethernet/eth_nxp_enet_qos/eth_nxp_enet_qos_mac.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,15 @@ static int eth_nxp_enet_qos_tx(const struct device *dev, struct net_pkt *pkt)
7373
frags_count++;
7474
total_bytes += fragment->len;
7575
fragment = fragment->frags;
76-
}
7776

78-
if (total_bytes > config->hw_info.max_frame_len ||
79-
frags_count > NUM_TX_BUFDESC) {
80-
LOG_ERR("TX packet too large");
81-
return -E2BIG;
77+
if (total_bytes > config->hw_info.max_frame_len ||
78+
frags_count > NUM_TX_BUFDESC) {
79+
LOG_ERR("TX packet too large");
80+
return -E2BIG;
81+
}
8282
}
8383

84+
8485
/* One TX at a time in the current implementation */
8586
k_sem_take(&data->tx.tx_sem, K_FOREVER);
8687

0 commit comments

Comments
 (0)