Hi Alexey,
On 7/13/26 8:35 PM, Alexey Charkov wrote:
Current code calculates the fractional component in 32 bits before
assigning it to a 64-bit holding variable, causing overflow for real-world
values of k, given that OSC_HZ is 24000000U. It also does bitwise manual
massaging of an unsigned representation of what is actually a two's
complement signed value, which is confusing and makes the code harder to
read.
Read k into a properly signed type and promote operands to avoid overflow,
which also enables the use of div_s64() to express the math more clearly.
Reviewed-by: Quentin Schulz <[email protected]>
I've quickly looked at the rest of the threads in this series and I
think there's no open questions left for me? You sent patches to the
kernel for making k an s16 so I'm assuming we'll go for that in U-Boot
as well. The PLLCON(2) thing for integer PLLs will need to be fixed one
way or another, but I'm assuming this is also something we need to fix
in the kernel so a similar approach would be nice. I don't think we need
to make this a big series fixing everything in one go, so feel free to
send smallish series whenever you're ready. Anything I'm missing?
Thanks!
Quentin