|
| From: | Philippe Mathieu-Daudé |
| Subject: | Re: [PATCH] hw/core: Handle cpu_model_from_type() returning NULL value |
| Date: | Thu, 11 Jan 2024 07:49:00 +0100 |
| User-agent: | Mozilla Thunderbird |
On 11/1/24 07:47, Philippe Mathieu-Daudé wrote:
Per cpu_model_from_type() docstring (added in commit 445946f4dd): * Returns: CPU model name or NULL if the CPU class doesn't exist We must check the return value in order to avoid surprises, i.e.: $ qemu-system-arm -machine virt -cpu cortex-a9
Doh I missed one space before the '$' character when pasting.
qemu-system-arm: Invalid CPU model: cortex-a9
The valid models are: cortex-a7, cortex-a15, (null), (null), (null), (null),
(null), (null), (null), (null), (null), (null), (null), max
Add assertions when the call can not fail (because the CPU type
must be registered).
Fixes: 5422d2a8fa ("machine: Print CPU model name instead of CPU type")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
cpu-target.c | 1 +
hw/core/machine.c | 5 +++++
target/ppc/cpu_init.c | 1 +
3 files changed, 7 insertions(+)
| [Prev in Thread] | Current Thread | [Next in Thread] |