On Tue, 5 Sep 2017 17:19:56 -0300 Eduardo Habkost <ehabk...@redhat.com> wrote:
> 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 <imamm...@redhat.com> > > --- > > 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? sure, I'll fix it up.