[PATCH v2 06/11] riscv: Fix incorrect cpu frequency on RV64

Sean Anderson seanga2 at gmail.com
Wed Jan 15 23:55:39 CET 2020


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(+)

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");
-- 
2.24.1



More information about the U-Boot mailing list