From 7effdaa32198b7077c51e29621dfca3d1b14e420 Mon Sep 17 00:00:00 2001 From: Mark Wu Date: Mon, 10 Mar 2014 22:37:41 +0800 Subject: spapr: Fix return value of vga initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before spapr_vga_init will returned false if the vga is specified by the command '-device VGA' because vga_interface_type was evaluated to VGA_NONE. With the change in previous patch of this series, spapr_vga_init should return true if it's told that the vga will be initialized in flow of the generic devices initialization. To keep '-nodefaults' have the semantics of bare minimum, it adds a check of 'has_defaults' in usb_enabled() to avoid that a USB controller is added by '-nodefautls, -device VGA' implicitly. This patch also makes two cleanups: 1. skip initialization for VGA_NONE 2. remove the useless 'break' Suggested-by: Paolo Bonzini Signed-off-by: Mark Wu Reviewed-by: Paolo Bonzini Signed-off-by: Andreas Färber --- vl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'vl.c') diff --git a/vl.c b/vl.c index 98f6460890..842e897d75 100644 --- a/vl.c +++ b/vl.c @@ -974,7 +974,8 @@ static void parse_name(QemuOpts *opts) bool usb_enabled(bool default_usb) { - return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", default_usb); + return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", + has_defaults && default_usb); } #ifndef _WIN32 -- cgit v1.2.1