diff --git a/src/class/net/ncm_device.c b/src/class/net/ncm_device.c index 4f75dc478..cf32514ba 100644 --- a/src/class/net/ncm_device.c +++ b/src/class/net/ncm_device.c @@ -340,7 +340,8 @@ static xmit_ntb_t *xmit_get_next_ready_ntb(void) { static bool xmit_insert_required_zlp(uint8_t rhport, uint32_t xferred_bytes) { TU_LOG_DRV("xmit_insert_required_zlp(%d,%ld)\n", rhport, xferred_bytes); - if (xferred_bytes == 0 || xferred_bytes % (tud_speed_get() == TUSB_SPEED_HIGH ? 512 : 64) != 0) { + uint16_t const ep_size = (tud_speed_get() == TUSB_SPEED_HIGH) ? 512 : 64; + if (xferred_bytes == 0 || xferred_bytes % ep_size != 0) { return false; }