From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm6ZZ-0004VG-Bh for qemu-devel@nongnu.org; Thu, 28 Nov 2013 13:44:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vm6ZI-0004Wl-J5 for qemu-devel@nongnu.org; Thu, 28 Nov 2013 13:44:21 -0500 Received: from ssl.serverraum.org ([88.198.40.39]:53822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vm6ZI-0004Vb-DJ for qemu-devel@nongnu.org; Thu, 28 Nov 2013 13:44:04 -0500 From: Michael Walle Date: Thu, 28 Nov 2013 19:43:22 +0100 Message-Id: <1385664202-13339-13-git-send-email-michael@walle.cc> In-Reply-To: <1385664202-13339-1-git-send-email-michael@walle.cc> References: <1385664202-13339-1-git-send-email-michael@walle.cc> Subject: [Qemu-devel] [PULL v3 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 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