]> Git Repo - qemu.git/commitdiff
net: simplify net_client_parse() error management
authorLaurent Vivier <[email protected]>
Fri, 21 Oct 2022 09:09:08 +0000 (11:09 +0200)
committerJason Wang <[email protected]>
Fri, 28 Oct 2022 05:28:52 +0000 (13:28 +0800)
All net_client_parse() callers exit in case of error.

Move exit(1) to net_client_parse() and remove error checking from
the callers.

Suggested-by: Markus Armbruster <[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
include/net/net.h
net/net.c
softmmu/vl.c

index c1c34a58f8495c4cd9b2dd986199d499188f8ae3..55023e7e9fa95d4bd7b83342120f8ccdfd69d265 100644 (file)
@@ -220,7 +220,7 @@ extern NICInfo nd_table[MAX_NICS];
 extern const char *host_net_devices[];
 
 /* from net.c */
-int net_client_parse(QemuOptsList *opts_list, const char *str);
+void net_client_parse(QemuOptsList *opts_list, const char *str);
 void show_netdevs(void);
 void net_init_clients(void);
 void net_check_clients(void);
index 5e788802b16efb2ebfb22498c537d9d474b356e2..178257abfdb85f6b096eddaa3078b2de99932dc3 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -1583,13 +1583,11 @@ void net_init_clients(void)
                       &error_fatal);
 }
 
-int net_client_parse(QemuOptsList *opts_list, const char *optarg)
+void net_client_parse(QemuOptsList *opts_list, const char *optarg)
 {
     if (!qemu_opts_parse_noisily(opts_list, optarg, true)) {
-        return -1;
+        exit(1);
     }
-
-    return 0;
 }
 
 /* From FreeBSD */
index a4ae131e4d6167c1f4b0a9c76d38269017519895..e69aa43de4696bf651134a536be29c03c251e9e3 100644 (file)
@@ -2801,21 +2801,15 @@ void qemu_init(int argc, char **argv)
                 break;
             case QEMU_OPTION_netdev:
                 default_net = 0;
-                if (net_client_parse(qemu_find_opts("netdev"), optarg) == -1) {
-                    exit(1);
-                }
+                net_client_parse(qemu_find_opts("netdev"), optarg);
                 break;
             case QEMU_OPTION_nic:
                 default_net = 0;
-                if (net_client_parse(qemu_find_opts("nic"), optarg) == -1) {
-                    exit(1);
-                }
+                net_client_parse(qemu_find_opts("nic"), optarg);
                 break;
             case QEMU_OPTION_net:
                 default_net = 0;
-                if (net_client_parse(qemu_find_opts("net"), optarg) == -1) {
-                    exit(1);
-                }
+                net_client_parse(qemu_find_opts("net"), optarg);
                 break;
 #ifdef CONFIG_LIBISCSI
             case QEMU_OPTION_iscsi:
This page took 0.030401 seconds and 4 git commands to generate.