[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v12 16/16] machine: Make smp_parse return a boolean
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH v12 16/16] machine: Make smp_parse return a boolean |
Date: |
Wed, 29 Sep 2021 09:28:30 +0100 |
User-agent: |
Mutt/2.0.7 (2021-05-04) |
On Wed, Sep 29, 2021 at 10:58:16AM +0800, Yanan Wang wrote:
> Quoting one of the Rules described in include/qapi/error.h:
> "
> Whenever practical, also return a value that indicates success /
> failure. This can make the error checking more concise, and can
> avoid useless error object creation and destruction. Note that
> we still have many functions returning void. We recommend
> • bool-valued functions return true on success / false on failure,
> • pointer-valued functions return non-null / null pointer, and
> • integer-valued functions return non-negative / negative.
> "
>
> So make smp_parse() return true on success and false on failure,
> so that we can more laconically check whether the parsing has
> succeeded without touching the errp.
>
> Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
> ---
> hw/core/machine.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
- [PATCH v12 03/16] machine: Minor refactor/fix for the smp parsers, (continued)
- [PATCH v12 03/16] machine: Minor refactor/fix for the smp parsers, Yanan Wang, 2021/09/28
- [PATCH v12 06/16] machine: Improve the error reporting of smp parsing, Yanan Wang, 2021/09/28
- [PATCH v12 09/16] machine: Prefer cores over sockets in smp parsing since 6.2, Yanan Wang, 2021/09/28
- [PATCH v12 05/16] machine: Set the value of cpus to match maxcpus if it's omitted, Yanan Wang, 2021/09/28
- [PATCH v12 08/16] qtest/numa-test: Use detailed -smp CLIs in test_def_cpu_split, Yanan Wang, 2021/09/28
- [PATCH v12 13/16] machine: Remove smp_parse callback from MachineClass, Yanan Wang, 2021/09/28
- [PATCH v12 12/16] machine: Make smp_parse generic enough for all arches, Yanan Wang, 2021/09/28
- [PATCH v12 15/16] machine: Put all sanity-check in the generic SMP parser, Yanan Wang, 2021/09/28
- [PATCH v12 16/16] machine: Make smp_parse return a boolean, Yanan Wang, 2021/09/28
- [PATCH v12 11/16] machine: Tweak the order of topology members in struct CpuTopology, Yanan Wang, 2021/09/28
- [PATCH v12 14/16] machine: Move smp_prefer_sockets to struct SMPCompatProps, Yanan Wang, 2021/09/28
- Re: [PATCH v12 00/16] machine: smp parsing fixes and improvement, Paolo Bonzini, 2021/09/29