diff options
| author | Alex Bennée <alex.bennee@linaro.org> | 2025-01-16 16:02:38 +0000 |
|---|---|---|
| committer | Alex Bennée <alex.bennee@linaro.org> | 2025-01-17 10:44:15 +0000 |
| commit | 05cdd648a846bd60e300fcfa1eabf8f20e589cba (patch) | |
| tree | 3909b7dc9b2d5e8de6bc5c653dae915a7c658dfe /system/vl.c | |
| parent | 77e911d0c76e91f1566afb9e76f05aee50f08e42 (diff) | |
| download | focaccia-qemu-05cdd648a846bd60e300fcfa1eabf8f20e589cba.tar.gz focaccia-qemu-05cdd648a846bd60e300fcfa1eabf8f20e589cba.zip | |
system: squash usb_parse into a single function
We don't need to wrap usb_device_add as usb_parse is already gated with an if (machine_usb(current_machine)) check. Instead just assert and directly fail if usbdevice_create returns NULL. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20250116160306.1709518-10-alex.bennee@linaro.org>
Diffstat (limited to 'system/vl.c')
| -rw-r--r-- | system/vl.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/system/vl.c b/system/vl.c index 22c1444da4..02795c5135 100644 --- a/system/vl.c +++ b/system/vl.c @@ -811,31 +811,17 @@ static void configure_msg(QemuOpts *opts) /***********************************************************/ /* USB devices */ -static int usb_device_add(const char *devname) +static int usb_parse(const char *cmdline) { - USBDevice *dev = NULL; + g_assert(machine_usb(current_machine)); - if (!machine_usb(current_machine)) { + if (!usbdevice_create(cmdline)) { + error_report("could not add USB device '%s'", cmdline); return -1; } - - dev = usbdevice_create(devname); - if (!dev) - return -1; - return 0; } -static int usb_parse(const char *cmdline) -{ - int r; - r = usb_device_add(cmdline); - if (r < 0) { - error_report("could not add USB device '%s'", cmdline); - } - return r; -} - /***********************************************************/ /* machine registration */ |