qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v8 3/9] machine: Improve is_cpu_type_supported()


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v8 3/9] machine: Improve is_cpu_type_supported()
Date: Fri, 1 Dec 2023 11:57:43 +0100
User-agent: Mozilla Thunderbird

On 29/11/23 05:20, Gavin Shan wrote:
It's no sense to check the CPU type when mc->valid_cpu_types[0] is
NULL.

This case is a programming error, right? We should simply:

 assert(!mc->valid_cpu_types || *mc->valid_cpu_types);

So the check is skipped for this particular case. The constraint
has been taken when the error messags are appended.

A precise hint for the error message is given when mc->valid_cpu_types[0]
is the only valid entry. Besides, enumeration on mc->valid_cpu_types[0]
when we have mutiple valid entries there is avoided to increase the code
readability, as suggested by Philippe Mathieu-Daudé.

Signed-off-by: Gavin Shan <gshan@redhat.com>
---
  hw/core/machine.c | 18 ++++++++++++------
  1 file changed, 12 insertions(+), 6 deletions(-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]