From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T24XJ-0006g2-5V for qemu-devel@nongnu.org; Thu, 16 Aug 2012 14:11:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T24XI-0001PS-7g for qemu-devel@nongnu.org; Thu, 16 Aug 2012 14:11:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60924) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T24XH-0001PI-WE for qemu-devel@nongnu.org; Thu, 16 Aug 2012 14:11:12 -0400 From: Eduardo Habkost Date: Thu, 16 Aug 2012 13:59:10 -0300 Message-Id: <1345136352-10756-12-git-send-email-ehabkost@redhat.com> In-Reply-To: <1345136352-10756-1-git-send-email-ehabkost@redhat.com> References: <1345136352-10756-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [RFC 11/13] check for NULL cpu_model outside cpu_x86_find_by_name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, gleb@redhat.com, vijaymohan.pandarathil@hp.com, jan.kiszka@siemens.com, mtosatti@redhat.com, mdroth@linux.vnet.ibm.com, blauwirbel@gmail.com, avi@redhat.com, pbonzini@redhat.com, akong@redhat.com, lersek@redhat.com, afaerber@suse.de cpu_x86_find_by_name() will go away when we move to CPU model classes. Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 2e24e00..9209bb1 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1402,11 +1402,6 @@ static int cpu_x86_find_by_name(X86CPU *cpu, X86CPUDefinition *x86_cpu_def, { X86CPUModelTableEntry *def; - if (!cpu_model) { - error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_model", "NULL"); - return -1; - } - for (def = x86_defs; def; def = def->next) { if (!strcmp(cpu_model, def->name)) { break; @@ -1521,6 +1516,11 @@ X86CPU *cpu_x86_create(const char *cpu_model) env = &cpu->env; env->cpu_model_str = cpu_model; + if (!cpu_model) { + error_set(&error, QERR_INVALID_PARAMETER_VALUE, "cpu_model", "NULL"); + goto error; + } + if (cpu_x86_find_by_name(cpu, def, name, &error) < 0) { goto error; } -- 1.7.11.2