Received: from eggs.gnu.org ([2001:4830:134:3::10]:58090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCXl7-0002Cr-Uo for qemu-devel@nongnu.org; Mon, 13 Jun 2016 15:42:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCXl4-00063d-Pm for qemu-devel@nongnu.org; Mon, 13 Jun 2016 15:42:53 -0400 Date: Mon, 13 Jun 2016 16:42:43 -0300 From: Eduardo Habkost Message-ID: <20160613194243.GK18662@thinpad.lan.raisama.net> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87fusgq5z2.fsf@dusky.pond.sub.org> 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: Markus Armbruster Cc: Eric Blake , kwolf@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com, borntraeger@de.ibm.com, cornelia.huck@de.ibm.com 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. 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