[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/22] system: squash usb_parse into a single function
From: |
Alex Bennée |
Subject: |
[PATCH 09/22] system: squash usb_parse into a single function |
Date: |
Thu, 9 Jan 2025 17:06:06 +0000 |
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.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
system/vl.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/system/vl.c b/system/vl.c
index 25d9968ccc..df59cff865 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 */
--
2.39.5
- [PATCH 00/22] maintainer updates for jan '25 (semihosting, gdb, plugins), Alex Bennée, 2025/01/09
- [PATCH 05/22] semihosting/arm-compat: Include missing 'cpu.h' header, Alex Bennée, 2025/01/09
- [PATCH 04/22] semihosting/uaccess: Include missing 'exec/cpu-all.h' header, Alex Bennée, 2025/01/09
- [PATCH 02/22] semihosting/uaccess: Briefly document returned values, Alex Bennée, 2025/01/09
- [PATCH 01/22] semihosting: add guest_error logging for failed opens, Alex Bennée, 2025/01/09
- [PATCH 09/22] system: squash usb_parse into a single function,
Alex Bennée <=
- [PATCH 13/22] tests/tcg/plugins/syscall: fix 32-bit build, Alex Bennée, 2025/01/09
- [PATCH 14/22] tests/tcg/plugins/mem: fix 32-bit build, Alex Bennée, 2025/01/09
- [PATCH 16/22] contrib/plugins/cache: fix 32-bit build, Alex Bennée, 2025/01/09
- [PATCH 07/22] semihosting/meson: Build config.o and console.o once, Alex Bennée, 2025/01/09
- [PATCH 12/22] contrib/plugins/howvec: ensure we don't regress if this plugin is extended, Alex Bennée, 2025/01/09
- [PATCH 08/22] system/vl: more error exit into config enumeration code, Alex Bennée, 2025/01/09