From patchwork Thu Aug 16 16:59:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 178061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4CAE72C00A1 for ; Fri, 17 Aug 2012 04:11:40 +1000 (EST) Received: from localhost ([::1]:48890 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T24Xi-00071H-7d for incoming@patchwork.ozlabs.org; Thu, 16 Aug 2012 14:11:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34368) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T24XM-0006mu-RG for qemu-devel@nongnu.org; Thu, 16 Aug 2012 14:11:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T24XL-0001QK-VZ for qemu-devel@nongnu.org; Thu, 16 Aug 2012 14:11:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6772) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T24XL-0001Py-N7 for qemu-devel@nongnu.org; Thu, 16 Aug 2012 14:11:15 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7GIAW2X021733 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 16 Aug 2012 14:11:06 -0400 Received: from blackpad.lan.raisama.net (vpn1-6-48.gru2.redhat.com [10.97.6.48]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q7GGw9Qm016799; Thu, 16 Aug 2012 12:58:10 -0400 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id C0D58201195; Thu, 16 Aug 2012 13:59:14 -0300 (BRT) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 16 Aug 2012 13:59:06 -0300 Message-Id: <1345136352-10756-8-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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 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 Subject: [Qemu-devel] [RFC 07/13] cpu_x86_create: move error handling to end of function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index da7b5af..0bf62da 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1544,12 +1544,14 @@ X86CPU *cpu_x86_create(const char *cpu_model) env->cpu_model_str = cpu_model; if (cpu_x86_register(cpu, cpu_model) < 0) { - object_delete(OBJECT(cpu)); - return NULL; + goto error; } x86_cpu_realize(OBJECT(cpu), NULL); return cpu; +error: + object_delete(OBJECT(cpu)); + return NULL; } #if !defined(CONFIG_USER_ONLY)