[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/37] system: squash usb_parse into a single function
From: |
Alex Bennée |
Subject: |
[PULL 09/37] system: squash usb_parse into a single function |
Date: |
Fri, 17 Jan 2025 13:42:28 +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.
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>
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 */
--
2.39.5
- [PULL 10/37] system: propagate Error to gdbserver_start (and other device setups), (continued)
- [PULL 10/37] system: propagate Error to gdbserver_start (and other device setups), Alex Bennée, 2025/01/17
- [PULL 15/37] contrib/plugins/stoptrigger: fix 32-bit build, Alex Bennée, 2025/01/17
- [PULL 23/37] win32: remove usage of attribute gcc_struct, Alex Bennée, 2025/01/17
- [PULL 12/37] contrib/plugins/howvec: ensure we don't regress if this plugin is extended, Alex Bennée, 2025/01/17
- [PULL 36/37] docs: add a glossary, Alex Bennée, 2025/01/17
- [PULL 30/37] include/exec: remove warning_printed from MemoryRegion, Alex Bennée, 2025/01/17
- [PULL 29/37] include/exec: fix some copy and paste errors in kdoc, Alex Bennée, 2025/01/17
- [PULL 14/37] tests/tcg/plugins/mem: fix 32-bit build, Alex Bennée, 2025/01/17
- [PULL 27/37] editorconfig: update for perl scripts, Alex Bennée, 2025/01/17
- [PULL 06/37] semihosting/console: Avoid including 'cpu.h', Alex Bennée, 2025/01/17
- [PULL 09/37] system: squash usb_parse into a single function,
Alex Bennée <=
- [PULL 22/37] accel/tcg: also suppress asynchronous IRQs for cpu_io_recompile, Alex Bennée, 2025/01/17
- [PULL 28/37] tests/qtest: fix some copy and paste errors in kdoc, Alex Bennée, 2025/01/17
- [PULL 33/37] docs/devel: add b4 for patch retrieval, Alex Bennée, 2025/01/17
- [PULL 35/37] docs/devel: add a codebase section, Alex Bennée, 2025/01/17
- [PULL 26/37] plugins: fix kdoc annotation, Alex Bennée, 2025/01/17
- [PULL 34/37] docs/devel: add information on how to setup build environments, Alex Bennée, 2025/01/17
- [PULL 19/37] contrib/plugins/hwprofile: fix 32-bit build, Alex Bennée, 2025/01/17
- [PULL 37/37] scripts/nsis.py: Run dependency check for each DLL file only once, Alex Bennée, 2025/01/17
- [PULL 20/37] contrib/plugins/hotpages: fix 32-bit build, Alex Bennée, 2025/01/17
- [PULL 31/37] docs/sphinx: include kernel-doc script as a dependency, Alex Bennée, 2025/01/17