mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-21 03:54:34 +00:00
fix(st-usb): replace redundant checks with asserts
Returning enum usb_status in an enum usb_action function is wrong as they have different meanings. However, usb_dwc2_ep0_out_start() and usb_dwc2_activate_setup() only return USBD_OK so we will never get to there. Replace these checks with asserts in case the code changes in future. This also silences a warning when compiling with -Wextra. Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Change-Id: I73dfd5c189a357544c15ceb3f4268da82ce272b9
This commit is contained in:
parent
9f58bfbbe9
commit
02af589cfa
1 changed files with 4 additions and 7 deletions
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <arch_helpers.h>
|
#include <arch_helpers.h>
|
||||||
|
@ -794,7 +795,7 @@ static enum usb_action usb_dwc2_it_handler(void *handle, uint32_t *param)
|
||||||
uint32_t epint;
|
uint32_t epint;
|
||||||
uint32_t epnum;
|
uint32_t epnum;
|
||||||
uint32_t temp;
|
uint32_t temp;
|
||||||
enum usb_status ret;
|
enum usb_status __unused ret;
|
||||||
|
|
||||||
if (usb_dwc2_get_mode(handle) != USB_OTG_MODE_DEVICE) {
|
if (usb_dwc2_get_mode(handle) != USB_OTG_MODE_DEVICE) {
|
||||||
return USB_NOTHING;
|
return USB_NOTHING;
|
||||||
|
@ -947,9 +948,7 @@ static enum usb_action usb_dwc2_it_handler(void *handle, uint32_t *param)
|
||||||
|
|
||||||
/* Setup EP0 to receive SETUP packets */
|
/* Setup EP0 to receive SETUP packets */
|
||||||
ret = usb_dwc2_ep0_out_start(handle);
|
ret = usb_dwc2_ep0_out_start(handle);
|
||||||
if (ret != USBD_OK) {
|
assert(ret == USBD_OK);
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
mmio_write_32(usb_base_addr + OTG_GINTSTS, OTG_GINTSTS_USBRST);
|
mmio_write_32(usb_base_addr + OTG_GINTSTS, OTG_GINTSTS_USBRST);
|
||||||
|
|
||||||
|
@ -959,9 +958,7 @@ static enum usb_action usb_dwc2_it_handler(void *handle, uint32_t *param)
|
||||||
/* Handle enumeration done interrupt */
|
/* Handle enumeration done interrupt */
|
||||||
if ((usb_dwc2_read_int(handle) & OTG_GINTSTS_ENUMDNE) != 0U) {
|
if ((usb_dwc2_read_int(handle) & OTG_GINTSTS_ENUMDNE) != 0U) {
|
||||||
ret = usb_dwc2_activate_setup(handle);
|
ret = usb_dwc2_activate_setup(handle);
|
||||||
if (ret != USBD_OK) {
|
assert(ret == USBD_OK);
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
mmio_clrbits_32(usb_base_addr + OTG_GUSBCFG, OTG_GUSBCFG_TRDT);
|
mmio_clrbits_32(usb_base_addr + OTG_GUSBCFG, OTG_GUSBCFG_TRDT);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue