drivers: clock_control: stm32u5: Fix frequency calculation overflow

STM32u5 pllout frequency calculation overflows. Fix by changing
order of operations

Signed-off-by: Benjamin Bigler <benjamin.bigler@securiton.ch>
This commit is contained in:
Benjamin Bigler 2022-08-11 07:33:58 +02:00 committed by Carles Cufí
parent a6a774c9f1
commit b9c6ca1d43

View file

@ -92,8 +92,7 @@ static uint32_t get_pllout_frequency(uint32_t pllsrc_freq,
{
__ASSERT_NO_MSG(pllm_div && pllout_div);
return (pllsrc_freq * plln_mul) /
(pllm_div * pllout_div);
return (pllsrc_freq / pllm_div) * plln_mul / pllout_div;
}
static uint32_t get_sysclk_frequency(void)