Eduardo Habkost <ehabk...@redhat.com> writes: > On Mon, Jun 13, 2016 at 08:49:37PM +0200, Markus Armbruster wrote: >> Eric Blake <ebl...@redhat.com> 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!