[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] error: Remove NULL checks on error_propagate() calls (ag
From: |
Markus Armbruster |
Subject: |
Re: [PATCH 3/4] error: Remove NULL checks on error_propagate() calls (again) |
Date: |
Thu, 23 Jul 2020 15:38:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Markus Armbruster <armbru@redhat.com> writes:
> Eric Blake <eblake@redhat.com> writes:
>
>> On 7/22/20 3:40 AM, Markus Armbruster wrote:
>>> Patch created mechanically by rerunning:
>>>
>>> $ spatch --sp-file scripts/coccinelle/error_propagate_null.cocci \
>>> --macro-file scripts/cocci-macro-file.h \
>>> --use-gitgrep .
>>>
>>> Cc: Jens Freimann <jfreimann@redhat.com>
>>> Cc: Hailiang Zhang <zhang.zhanghailiang@huawei.com>
>>> Cc: Juan Quintela <quintela@redhat.com>
>>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>> ---
>>
>>> +++ b/migration/colo.c
>>> @@ -798,9 +798,7 @@ static void
>>> colo_incoming_process_checkpoint(MigrationIncomingState *mis,
>>> colo_send_message(mis->to_src_file,
>>> COLO_MESSAGE_VMSTATE_LOADED,
>>> &local_err);
>>> - if (local_err) {
>>> - error_propagate(errp, local_err);
>>> - }
>>> + error_propagate(errp, local_err);
>>> }
>>
>> As this is mechanical, it is fine. But there is now a further cleanup
>> possible of passing errp directly to colo_send_message, and possibly
>> dropping local_err altogether.
>
> True.
>
> The patch is small and simple enough for squashing in further manual
> cleanups. I'd like to first check whether a followup patch created with
> the machinery I used for eliminating error_propagate() comes out better.
Vladimir's scripts/coccinelle/errp-guard.cocci will take care of it.
Eliminating error propagation altogether would be even better, but it's
also more work: several void functions need to return bool instead.
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>
> Thanks!
[PATCH 2/4] error: Strip trailing '\n' from error string arguments (again), Markus Armbruster, 2020/07/22
[PATCH 1/4] coccinelle/err-bad-newline: Fix for Python 3, and add patterns, Markus Armbruster, 2020/07/22
[PATCH 4/4] error: Use error_fatal to simplify obvious fatal errors (again), Markus Armbruster, 2020/07/22
Re: [PATCH 0/4] error: Mechanical fixes & cleanups, Markus Armbruster, 2020/07/24