USB MSC - use invalid return types in generated usbd_storage_if.c
USB MSC - use invalid return types in usbd_storage_if.c
=> see stated in the generated comments:
"@retval USBD_OK if all operations are OK else USBD_FAIL"
where USBD_OK = 0, USBD_FAIL = 3 (defined in usbd_def.h)
the functions in usbd_storage_if.c get called in usbd_msc_scsi.c but error/fail is checked by "<0"
e.g.:
if (((USBD_StorageTypeDef *)pdev->pUserData)->Read(lun, hmsc->bot_data,
hmsc->scsi_blk_addr,
(len / hmsc->scsi_blk_size)) < 0)=> return USBD_FAIL will never trigger the error in usbd_storage_if.c
steps to reproduce:
- STM32CubeIDE: new Project with Board: "STM32L4R9I-DISCO"
- Initialize all periphials default... <YES>
- SDMMC1 => already configured
- USB_OTG_FS - Device_only => already configured
- Middleware->USB_DEVICE: set MODE= MASS Storage Class
- Generate Code
STM32CubeIDE Version: 1.4.2
FW_Version:
STM32Cube FW_L4 V1.16.0
