[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 37/44] error: Reduce unnecessary error propagation
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v2 37/44] error: Reduce unnecessary error propagation |
Date: |
Fri, 03 Jul 2020 09:09:09 +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, even when we need to keep error_propagate() for other
>> error paths.
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>
>> +++ b/block/replication.c
>> @@ -85,7 +85,6 @@ static int replication_open(BlockDriverState *bs, QDict
>> *options,
>> {
>> int ret;
>> BDRVReplicationState *s = bs->opaque;
>> - Error *local_err = NULL;
>> QemuOpts *opts = NULL;
>> const char *mode;
>> const char *top_id;
>> @@ -99,7 +98,7 @@ static int replication_open(BlockDriverState *bs, QDict
>> *options,
>> ret = -EINVAL;
>> opts = qemu_opts_create(&replication_runtime_opts, NULL, 0,
>> &error_abort);
>> - if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
>> + if (!qemu_opts_absorb_qdict(opts, options, errp)) {
>> goto fail;
>> }
>
> Does this one belong in 36/44, given that removal of 'local_err' is
> evidence that no other error path needed it?
>
> Either way, it belongs in the series, and the result of the two
> patches together is fine.
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
Actually, this hunk needs to go before PATCH 33 to keep it correct.
I'll find out how to best reshuffle hunks. The end result will be the
same.
Thanks!
- [PATCH v2 31/44] qdev: Make functions taking Error ** return bool, not void, (continued)
- [PATCH v2 31/44] qdev: Make functions taking Error ** return bool, not void, Markus Armbruster, 2020/07/02
- [PATCH v2 44/44] hmp: Ignore Error objects where the return value suffices, Markus Armbruster, 2020/07/02
- [PATCH v2 19/44] block/parallels: Simplify parallels_open() after previous commit, Markus Armbruster, 2020/07/02
- [PATCH v2 27/44] qom: Make functions taking Error ** return bool, not void, Markus Armbruster, 2020/07/02
- [PATCH v2 10/44] qemu-option: Factor out helper opt_create(), Markus Armbruster, 2020/07/02
- [PATCH v2 42/44] qemu-img: Ignore Error objects where the return value suffices, Markus Armbruster, 2020/07/02
- [PATCH v2 37/44] error: Reduce unnecessary error propagation, Markus Armbruster, 2020/07/02
- [PATCH v2 16/44] qapi: Make visitor functions taking Error ** return bool, not void, Markus Armbruster, 2020/07/02
- [PATCH v2 30/44] qom: Make functions taking Error ** return bool, not 0/-1, Markus Armbruster, 2020/07/02
- [PATCH v2 07/44] qemu-option: Make uses of find_desc_by_name() more similar, Markus Armbruster, 2020/07/02
- [PATCH v2 18/44] qapi: Use returned bool to check for failure, manual part, Markus Armbruster, 2020/07/02
- [PATCH v2 33/44] error: Avoid unnecessary error_propagate() after error_setg(), Markus Armbruster, 2020/07/02