Skip to content

Commit b45d423

Browse files
author
Paul Thompson
committed
Make the atomic_clr_u32 conditional use raw values rather than computed, remove need for guards
1 parent 2211a27 commit b45d423

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_pcd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t
13071307
ep = &hpcd->IN_ep[epnum];
13081308
len = ep->xfer_len - ep->xfer_count;
13091309

1310-
if (((int32_t)len > 0) && (len > ep->maxpacket))
1310+
if (len > ep->maxpacket)
13111311
{
13121312
len = ep->maxpacket;
13131313
}
@@ -1322,7 +1322,7 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t
13221322
/* Write the FIFO */
13231323
len = ep->xfer_len - ep->xfer_count;
13241324

1325-
if (((int32_t)len > 0) && (len > ep->maxpacket))
1325+
if (len > ep->maxpacket)
13261326
{
13271327
len = ep->maxpacket;
13281328
}
@@ -1334,7 +1334,7 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t
13341334
ep->xfer_count += len;
13351335
}
13361336

1337-
if ((int32_t)len <= 0)
1337+
if (ep->xfer_count >= ep->xfer_len)
13381338
{
13391339
fifoemptymsk = 0x1 << epnum;
13401340
atomic_clr_u32(&USBx_DEVICE->DIEPEMPMSK, fifoemptymsk); // MBED: changed

0 commit comments

Comments
 (0)