From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVNzq-00032T-TN for qemu-devel@nongnu.org; Fri, 18 May 2012 10:17:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SVNzk-0005i9-ID for qemu-devel@nongnu.org; Fri, 18 May 2012 10:17:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVNzk-0005hz-A9 for qemu-devel@nongnu.org; Fri, 18 May 2012 10:17:28 -0400 Message-ID: <4FB65A33.4020000@redhat.com> Date: Fri, 18 May 2012 16:18:27 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <1337265221-7136-1-git-send-email-lcapitulino@redhat.com> <1337265221-7136-7-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1337265221-7136-7-git-send-email-lcapitulino@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 06/16] qemu-option: qemu_opts_validate(): use error_set() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, armbru@redhat.com, mdroth@linux.vnet.ibm.com On 05/17/12 16:33, Luiz Capitulino wrote: > @@ -1060,21 +1060,18 @@ int qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc) > } > } > if (desc[i].name == NULL) { > - qerror_report(QERR_INVALID_PARAMETER, opt->name); > - return -1; > + error_set(errp, QERR_INVALID_PARAMETER, opt->name); > + return; > } > > opt->desc = &desc[i]; > > qemu_opt_parse(opt, &local_err); > if (error_is_set(&local_err)) { > - qerror_report_err(local_err); > - error_free(local_err); > - return -1; > + error_propagate(errp, local_err); > + return; > } > } > - > - return 0; > } (I *almost* suggested to drop "local_err" and pass "errp" directly to qemu_opt_parse(), since the "if" body consists of nothing more than error_propagate() now. But then I noticed the "return" that aborts the QTAILQ_FOREACH(), and so we do have to rely on "local_err" -- "errp" could be NULL, and we could not check *errp for loop-exit purposes. Good.) Laszlo