From patchwork Wed Jan 15 22:55:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 239630 List-Id: U-Boot discussion From: seanga2 at gmail.com (Sean Anderson) Date: Wed, 15 Jan 2020 17:55:39 -0500 Subject: [PATCH v2 06/11] riscv: Fix incorrect cpu frequency on RV64 In-Reply-To: <3411d84b-5a56-ae4e-1deb-085ef1a4971d@gmail.com> References: <3411d84b-5a56-ae4e-1deb-085ef1a4971d@gmail.com> Message-ID: <0b623be8-a24e-e200-c406-be54d84bb04a@gmail.com> The riscv_cpu_get_info function does not always zero-out cpu_freq. This can cause spurious higher frequencies. Signed-off-by Sean Anderson Reviewed-by: Lukas Auer --- 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");