From 9ee05825d9eaf7fe3aaed5ed04b83612ede704a0 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 25 Sep 2009 03:53:50 +0200 Subject: Make it obvious that pci_nic_init() can't fail Before this patch, pci_nic_init() returns NULL when it can't find the model in pci_nic_models[]. Except this can't happen, because qemu_check_nic_model_list() just searched for model in pci_nic_models[], and terminated the program on failure. Repeating the search here is pointless. Instead, change qemu_check_nic_model_list() to return the model's array index. Signed-off-by: Markus Armbruster Signed-off-by: Anthony Liguori --- net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'net.c') diff --git a/net.c b/net.c index bcc517633b..2feabbcf71 100644 --- a/net.c +++ b/net.c @@ -2358,8 +2358,8 @@ void qemu_check_nic_model(NICInfo *nd, const char *model) qemu_check_nic_model_list(nd, models, model); } -void qemu_check_nic_model_list(NICInfo *nd, const char * const *models, - const char *default_model) +int qemu_check_nic_model_list(NICInfo *nd, const char * const *models, + const char *default_model) { int i, exit_status = 0; @@ -2369,7 +2369,7 @@ void qemu_check_nic_model_list(NICInfo *nd, const char * const *models, if (strcmp(nd->model, "?") != 0) { for (i = 0 ; models[i]; i++) if (strcmp(nd->model, models[i]) == 0) - return; + return i; fprintf(stderr, "qemu: Unsupported NIC model: %s\n", nd->model); exit_status = 1; -- cgit 1.4.1