[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 36/44] error: Eliminate error_propagate() manually
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v2 36/44] error: Eliminate error_propagate() manually |
Date: |
Fri, 03 Jul 2020 08:59:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Eric Blake <eblake@redhat.com> writes:
> On 7/2/20 10:49 AM, Markus Armbruster wrote:
>> When all we do with an Error we receive into a local variable is
>> propagating to somewhere else, we can just as well receive it there
>> right away. The previous two commits did that for sufficiently simple
>> cases with Coccinelle. Do it for several more manually.
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>
>> +++ b/qdev-monitor.c
>> @@ -597,7 +597,6 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error
>> **errp)
>> const char *driver, *path;
>> DeviceState *dev = NULL;
>> BusState *bus = NULL;
>> - Error *err = NULL;
>> bool hide;
>> driver = qemu_opt_get(opts, "driver");
>> @@ -652,15 +651,14 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error
>> **errp)
>> dev = qdev_new(driver);
>> /* Check whether the hotplug is allowed by the machine */
>> - if (qdev_hotplug && !qdev_hotplug_allowed(dev, &err)) {
>> + if (qdev_hotplug && !qdev_hotplug_allowed(dev, errp)) {
>> /* Error must be set in the machine hook */
>> - assert(err);
>
> That comment could be deleted now.
Yes.
> Either way,
> Reviewed-by: Eric Blake <eblake@redhat.com>
Thanks!
- Re: [PATCH v2 03/44] qdev: Use returned bool to check for qdev_realize() etc. failure, (continued)
- [PATCH v2 29/44] qom: Use returned bool to check for failure, manual part, Markus Armbruster, 2020/07/02
- [PATCH v2 17/44] qapi: Use returned bool to check for failure, Coccinelle part, Markus Armbruster, 2020/07/02
- [PATCH v2 20/44] s390x/pci: Fix harmless mistake in zpci's property fid's setter, Markus Armbruster, 2020/07/02
- [PATCH v2 36/44] error: Eliminate error_propagate() manually, Markus Armbruster, 2020/07/02
- [PATCH v2 25/44] qom: Use return values to check for error where that's simpler, Markus Armbruster, 2020/07/02
- [PATCH v2 43/44] qdev: Ignore Error objects where the return value suffices, Markus Armbruster, 2020/07/02
- [PATCH v2 41/44] error: Avoid error_propagate() after migrate_add_blocker(), Markus Armbruster, 2020/07/02
- [PATCH v2 12/44] qemu-option: Make functions taking Error ** return bool, not void, Markus Armbruster, 2020/07/02
- [PATCH v2 14/44] block: Avoid error accumulation in bdrv_img_create(), Markus Armbruster, 2020/07/02