Received: from eggs.gnu.org ([2001:4830:134:3::10]:37503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCjVI-0006P3-0N for qemu-devel@nongnu.org; Tue, 14 Jun 2016 04:15:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCjVE-0000cL-02 for qemu-devel@nongnu.org; Tue, 14 Jun 2016 04:15:19 -0400 From: Markus Armbruster References: <1465589538-24998-1-git-send-email-ehabkost@redhat.com> <1465589538-24998-3-git-send-email-ehabkost@redhat.com> <87k2htwc14.fsf@dusky.pond.sub.org> <20160613155226.GH18662@thinpad.lan.raisama.net> <575ED8CC.6010601@redhat.com> <87fusgq5z2.fsf@dusky.pond.sub.org> <20160613194243.GK18662@thinpad.lan.raisama.net> Date: Tue, 14 Jun 2016 10:15:04 +0200 In-Reply-To: <20160613194243.GK18662@thinpad.lan.raisama.net> (Eduardo Habkost's message of "Mon, 13 Jun 2016 16:42:43 -0300") Message-ID: <871t40mbjr.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 2/3] error: Remove unnecessary local_err variables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, borntraeger@de.ibm.com, cornelia.huck@de.ibm.com Eduardo Habkost writes: > On Mon, Jun 13, 2016 at 08:49:37PM +0200, Markus Armbruster wrote: >> Eric Blake 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!