Message ID | 0b623be8-a24e-e200-c406-be54d84bb04a@gmail.com |
---|---|
State | New |
Headers | show |
Series | riscv: Add Sipeed Maix support | expand |
On Wed, 2020-01-15 at 17:55 -0500, Sean Anderson wrote: > The riscv_cpu_get_info function does not always zero-out cpu_freq. This can > cause spurious higher frequencies. > > Signed-off-by Sean Anderson <seanga2 at gmail.com> > --- > Changes for v2: > New. > > drivers/cpu/riscv_cpu.c | 2 ++ > 1 file changed, 2 insertions(+) > Reviewed-by: Lukas Auer <lukas at auer.io>
diff --git a/drivers/cpu/riscv_cpu.c b/drivers/cpu/riscv_cpu.c index 28ad0aa30f..1e32bb5678 100644 --- a/drivers/cpu/riscv_cpu.c +++ b/drivers/cpu/riscv_cpu.c @@ -29,6 +29,8 @@ static int riscv_cpu_get_info(struct udevice *dev, struct cpu_info *info) { const char *mmu; + /* Zero out the frequency, in case sizeof(ulong) != sizeof(u32) */ + info->cpu_freq = 0; dev_read_u32(dev, "clock-frequency", (u32 *)&info->cpu_freq); mmu = dev_read_string(dev, "mmu-type");