From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5Kce-0006CA-J5 for qemu-devel@nongnu.org; Mon, 20 Jan 2014 14:35:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5KcY-0005d2-4V for qemu-devel@nongnu.org; Mon, 20 Jan 2014 14:35:00 -0500 Received: from ssl.serverraum.org ([2a01:4f8:a0:1283::1:2]:59484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5KcX-0005cM-Ub for qemu-devel@nongnu.org; Mon, 20 Jan 2014 14:34:54 -0500 From: Michael Walle Date: Mon, 20 Jan 2014 20:34:30 +0100 Message-Id: <1390246471-25167-13-git-send-email-michael@walle.cc> In-Reply-To: <1390246471-25167-1-git-send-email-michael@walle.cc> References: <1390246471-25167-1-git-send-email-michael@walle.cc> Subject: [Qemu-devel] [PULL v4 12/12] hw/lm32: print error if cpu model is not found List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Michael Walle , Anthony Liguori QEMU crashed if a the given cpu_model is not found. Signed-off-by: Michael Walle --- hw/lm32/lm32_boards.c | 10 ++++++++++ hw/lm32/milkymist.c | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c index c032bb8..5e22e9b 100644 --- a/hw/lm32/lm32_boards.c +++ b/hw/lm32/lm32_boards.c @@ -101,6 +101,11 @@ static void lm32_evr_init(QEMUMachineInitArgs *args) cpu_model = "lm32-full"; } cpu = cpu_lm32_init(cpu_model); + if (cpu == NULL) { + fprintf(stderr, "qemu: unable to find CPU '%s'\n", cpu_model); + exit(1); + } + env = &cpu->env; reset_info->cpu = cpu; @@ -198,6 +203,11 @@ static void lm32_uclinux_init(QEMUMachineInitArgs *args) cpu_model = "lm32-full"; } cpu = cpu_lm32_init(cpu_model); + if (cpu == NULL) { + fprintf(stderr, "qemu: unable to find CPU '%s'\n", cpu_model); + exit(1); + } + env = &cpu->env; reset_info->cpu = cpu; diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index 15053c4..baf234c 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -108,6 +108,11 @@ milkymist_init(QEMUMachineInitArgs *args) cpu_model = "lm32-full"; } cpu = cpu_lm32_init(cpu_model); + if (cpu == NULL) { + fprintf(stderr, "qemu: unable to find CPU '%s'\n", cpu_model); + exit(1); + } + env = &cpu->env; reset_info->cpu = cpu; -- 1.7.10.4