From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpKKQ-0002Zn-UN for qemu-devel@nongnu.org; Tue, 05 Sep 2017 16:20:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpKKJ-0000ZO-7A for qemu-devel@nongnu.org; Tue, 05 Sep 2017 16:20:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37636) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpKKJ-0000Yv-1M for qemu-devel@nongnu.org; Tue, 05 Sep 2017 16:20:03 -0400 Date: Tue, 5 Sep 2017 17:19:56 -0300 From: Eduardo Habkost Message-ID: <20170905201956.GF17184@localhost.localdomain> References: <1504533662-198084-1-git-send-email-imammedo@redhat.com> <1504533662-198084-3-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1504533662-198084-3-git-send-email-imammedo@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/6] cpu: make cpu_generic_init() abort QEMU on error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, Peter Maydell , Anthony Green , Mark Cave-Ayland , Max Filippov , "Edgar E. Iglesias" , Guan Xuetao , Jia Liu , Magnus Damm , Alexander Graf , =?iso-8859-1?Q?Herv=E9?= Poussineau , Richard Henderson , Artyom Tarasenko , Andrew Jones , Riku Voipio , Fabien Chouteau , Jan Kiszka , Yongbok Kim , Stafford Horne , David Gibson , Thomas Huth , Bastian Koppelmann , Laurent Vivier , Michael Walle , Aurelien Jarno On Mon, Sep 04, 2017 at 04:00:58PM +0200, Igor Mammedov wrote: > Almost every user of cpu_generic_init() checks for > returned NULL and then reports failure in a custom way > and aborts process. > Some users assume that call can't fail and don't check > for failure, though they should have checked for it. > > In either cases cpu_generic_init() failure is fatal, > so instead of checking for failure and reporting > it various ways, make cpu_generic_init() report > errors in consistent way and terminate QEMU on failure. > > Signed-off-by: Igor Mammedov > --- > Even though it's tree wide change, it's trivial so all > affected call sites are included within one patch. > [...] > diff --git a/qom/cpu.c b/qom/cpu.c > index d715890..307d638 100644 > --- a/qom/cpu.c > +++ b/qom/cpu.c > @@ -61,7 +61,7 @@ CPUState *cpu_create(const char *typename) > if (err != NULL) { > error_report_err(err); > object_unref(OBJECT(cpu)); > - return NULL; > + exit(EXIT_FAILURE); Isn't it simpler to use &error_fatal? -- Eduardo