hw/ppc/spapr.c: fail early if no firmware found in machine_init()
commit5f2b96b38e125f624c5dc0bf84de0bbc2efb0523
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 2 Mar 2022 05:51:39 +0000 (2 06:51 +0100)
committerCédric Le Goater <clg@kaod.org>
Wed, 2 Mar 2022 05:51:39 +0000 (2 06:51 +0100)
treecbc63512a662c5751b0167b69fa50f50129e064e
parentaebb9b9cb2738c2a0b21c7315822fac7d9bb5004
hw/ppc/spapr.c: fail early if no firmware found in machine_init()

The firmware check consists on a file search (qemu_find_file) and load
it via load_imag_targphys(). This validation is not dependent on any
other machine state but it currently being done at the end of
spapr_machine_init(). This means that we can do a lot of stuff and end
up failing at the end for something that we can verify right out of the
gate.

Move this validation to the start of spapr_machine_init() to fail
earlier.  While we're at it, use g_autofree in the 'filename' pointer.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220228175004.8862-3-danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
hw/ppc/spapr.c