]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
fix(stm32mp1): rework DWL buffer cache invalidation
authorYann Gautier <yann.gautier@st.com>
Fri, 25 Nov 2022 14:33:09 +0000 (15:33 +0100)
committerYann Gautier <yann.gautier@st.com>
Wed, 7 Dec 2022 13:20:01 +0000 (14:20 +0100)
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 <yann.gautier@st.com>
Change-Id: I90d2951f9518509b3380295fb1a6ad6b9c5e551e

plat/st/stm32mp1/bl2_plat_setup.c

index 4f04a6f03c402d079e4f1b251d9611f92ffb9df2..87d2d39e169e1b9216febe77f2a3c8bc98f0a793 100644 (file)
@@ -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();
 }