qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-block] [PATCH v2 2/3] error: Remove unnecessary l


From: Markus Armbruster
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 2/3] error: Remove unnecessary local_err variables
Date: Tue, 14 Jun 2016 10:15:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eduardo Habkost <address@hidden> writes:

> On Mon, Jun 13, 2016 at 08:49:37PM +0200, Markus Armbruster wrote:
>> Eric Blake <address@hidden> writes:
> [...]
>> >> 
>> >> See, e.g.:
>> >> 
>> >> void qmp_guest_suspend_disk(Error **errp)
>> >> {
>> >>     Error *local_err = NULL;
>> >>     GuestSuspendMode *mode = g_new(GuestSuspendMode, 1);
>> >> 
>> >>     *mode = GUEST_SUSPEND_MODE_DISK;
>> >>     check_suspend_mode(*mode, &local_err);
>> >>     acquire_privilege(SE_SHUTDOWN_NAME, &local_err);
>> >>     execute_async(do_suspend, mode, &local_err);
>> >
>> > That usage is a bug.  A Coccinelle script to root out such buggy
>> > instances would be nice.
>> 
>> We've discussed this before.  See for instance commit 297a364:
>> 
>>     qapi: Replace uncommon use of the error API by the common one
>
> That explains why I was confused: I remember seeing that QAPI
> visitors could be called with *errp set.

Nothing confuses as effectively as bad examples.

> I will try to change the script as suggested, to only apply the
> changes if errp is never touched before the error_setg() call.

Thanks!



reply via email to

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