From: Yann Gautier Date: Fri, 25 Nov 2022 14:33:09 +0000 (+0100) Subject: fix(stm32mp1): rework DWL buffer cache invalidation X-Git-Tag: baikal/aarch64/sdk5.10~1^2~313^2 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=127ed0008e03abb98b5447cb80c5634dfa554e7d;p=arm-tf.git fix(stm32mp1): rework DWL buffer cache invalidation As the default part do nothing, all the code managing DWL buffer cache invalidation can be under programmer flags. This avoids running unneeded code if the flags are not enabled, and corrects MISRA C2012-16.6: Every switch statement shall have at least two switch-clauses. Signed-off-by: Yann Gautier Change-Id: I90d2951f9518509b3380295fb1a6ad6b9c5e551e --- diff --git a/plat/st/stm32mp1/bl2_plat_setup.c b/plat/st/stm32mp1/bl2_plat_setup.c index 4f04a6f03..87d2d39e1 100644 --- a/plat/st/stm32mp1/bl2_plat_setup.c +++ b/plat/st/stm32mp1/bl2_plat_setup.c @@ -543,20 +543,15 @@ int bl2_plat_handle_post_image_load(unsigned int image_id) void bl2_el3_plat_prepare_exit(void) { +#if STM32MP_UART_PROGRAMMER || STM32MP_USB_PROGRAMMER uint16_t boot_itf = stm32mp_get_boot_itf_selected(); - switch (boot_itf) { -#if STM32MP_UART_PROGRAMMER || STM32MP_USB_PROGRAMMER - case BOOT_API_CTX_BOOT_INTERFACE_SEL_SERIAL_UART: - case BOOT_API_CTX_BOOT_INTERFACE_SEL_SERIAL_USB: + if ((boot_itf == BOOT_API_CTX_BOOT_INTERFACE_SEL_SERIAL_UART) || + (boot_itf == BOOT_API_CTX_BOOT_INTERFACE_SEL_SERIAL_USB)) { /* Invalidate the downloaded buffer used with io_memmap */ inv_dcache_range(DWL_BUFFER_BASE, DWL_BUFFER_SIZE); - break; -#endif /* STM32MP_UART_PROGRAMMER || STM32MP_USB_PROGRAMMER */ - default: - /* Do nothing in default case */ - break; } +#endif /* STM32MP_UART_PROGRAMMER || STM32MP_USB_PROGRAMMER */ stm32mp1_security_setup(); }