Skip to content

Commit 2211a27

Browse files
author
Paul Thompson
committed
Drop usage of ilen, just use len and cast it to int32_t as appropriate
1 parent 8f4a5e2 commit 2211a27

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_pcd.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,15 +1301,13 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t
13011301
USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
13021302
USB_OTG_EPTypeDef *ep;
13031303
uint32_t len;
1304-
int32_t ilen;
13051304
uint32_t len32b;
13061305
uint32_t fifoemptymsk = 0;
13071306

13081307
ep = &hpcd->IN_ep[epnum];
1309-
ilen = ep->xfer_len - ep->xfer_count;
1310-
len = ilen;
1308+
len = ep->xfer_len - ep->xfer_count;
13111309

1312-
if ((ilen > 0) && (len > ep->maxpacket))
1310+
if (((int32_t)len > 0) && (len > ep->maxpacket))
13131311
{
13141312
len = ep->maxpacket;
13151313
}
@@ -1322,10 +1320,9 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t
13221320
ep->xfer_len != 0)
13231321
{
13241322
/* Write the FIFO */
1325-
ilen = ep->xfer_len - ep->xfer_count;
1326-
len = ilen;
1323+
len = ep->xfer_len - ep->xfer_count;
13271324

1328-
if ((ilen > 0) && (len > ep->maxpacket))
1325+
if (((int32_t)len > 0) && (len > ep->maxpacket))
13291326
{
13301327
len = ep->maxpacket;
13311328
}
@@ -1337,7 +1334,7 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t
13371334
ep->xfer_count += len;
13381335
}
13391336

1340-
if(ilen <= 0)
1337+
if ((int32_t)len <= 0)
13411338
{
13421339
fifoemptymsk = 0x1 << epnum;
13431340
atomic_clr_u32(&USBx_DEVICE->DIEPEMPMSK, fifoemptymsk); // MBED: changed

0 commit comments

Comments
 (0)