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: Eduardo Habkost
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 2/3] error: Remove unnecessary local_err variables
Date: Mon, 13 Jun 2016 16:42:43 -0300
User-agent: Mutt/1.6.1 (2016-04-27)

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.

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

-- 
Eduardo



reply via email to

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