Skip to content

Commit f70fbc3

Browse files
authored
Merge pull request #11829 from facchinm/remove_assert_from_stm32_usb
USB STM32: Don't wrap direct function calls in MBED_ASSERT
2 parents f079dce + 8daa2d7 commit f70fbc3

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

targets/TARGET_STM/USBPhy_STM32.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ void USBPhyHw::init(USBPhyEvents *events)
239239
// Configure PCD and FIFOs
240240
hpcd.pData = (void *)this;
241241
hpcd.State = HAL_PCD_STATE_RESET;
242-
MBED_ASSERT(HAL_PCD_Init(&hpcd) == HAL_OK);
242+
HAL_StatusTypeDef ret = HAL_PCD_Init(&hpcd);
243+
MBED_ASSERT(ret == HAL_OK);
243244

244245

245246
uint32_t total_bytes = 0;
@@ -272,7 +273,9 @@ void USBPhyHw::init(USBPhyEvents *events)
272273

273274
void USBPhyHw::deinit()
274275
{
275-
MBED_ASSERT(HAL_PCD_DeInit(&hpcd) == HAL_OK);
276+
HAL_StatusTypeDef ret = HAL_PCD_DeInit(&hpcd);
277+
MBED_ASSERT(ret == HAL_OK);
278+
276279
NVIC_DisableIRQ(USBHAL_IRQn);
277280

278281
if (events != NULL) {
@@ -288,12 +291,14 @@ bool USBPhyHw::powered()
288291

289292
void USBPhyHw::connect()
290293
{
291-
MBED_ASSERT(HAL_PCD_Start(&hpcd) == HAL_OK);
294+
HAL_StatusTypeDef ret = HAL_PCD_Start(&hpcd);
295+
MBED_ASSERT(ret == HAL_OK);
292296
}
293297

294298
void USBPhyHw::disconnect()
295299
{
296-
MBED_ASSERT(HAL_PCD_Stop(&hpcd) == HAL_OK);
300+
HAL_StatusTypeDef ret = HAL_PCD_Stop(&hpcd);
301+
MBED_ASSERT(ret == HAL_OK);
297302
}
298303

299304
void USBPhyHw::configure()
@@ -318,7 +323,8 @@ void USBPhyHw::sof_disable()
318323

319324
void USBPhyHw::set_address(uint8_t address)
320325
{
321-
MBED_ASSERT(HAL_PCD_SetAddress(&hpcd, address) == HAL_OK);
326+
HAL_StatusTypeDef ret = HAL_PCD_SetAddress(&hpcd, address);
327+
MBED_ASSERT(ret == HAL_OK);
322328
}
323329

324330
void USBPhyHw::remote_wakeup()

0 commit comments

Comments
 (0)