From patchwork Wed Nov 28 06:20:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liguang X-Patchwork-Id: 202374 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 A7A7D2C0095 for ; Wed, 28 Nov 2012 17:22:47 +1100 (EST) Received: from localhost ([::1]:33563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdb2j-0008Kg-M4 for incoming@patchwork.ozlabs.org; Wed, 28 Nov 2012 01:22:45 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdb2c-0008KQ-9G for qemu-devel@nongnu.org; Wed, 28 Nov 2012 01:22:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tdb2b-0007up-AE for qemu-devel@nongnu.org; Wed, 28 Nov 2012 01:22:38 -0500 Received: from [222.73.24.84] (port=26469 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tdb2b-0007uh-0H for qemu-devel@nongnu.org; Wed, 28 Nov 2012 01:22:37 -0500 X-IronPort-AV: E=Sophos;i="4.83,332,1352044800"; d="scan'208";a="6290386" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 28 Nov 2012 14:20:51 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id qAS6MZmM010562; Wed, 28 Nov 2012 14:22:35 +0800 Received: from liguang.fnst.cn.fujitsu.com ([10.167.225.128]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2012112814220881-126363 ; Wed, 28 Nov 2012 14:22:08 +0800 From: liguang To: ehabkost@redhat.com, imammedo@redhat.com, afaerber@suse.de, qemu-devel@nongnu.org Date: Wed, 28 Nov 2012 14:20:23 +0800 Message-Id: <1354083623-2483-1-git-send-email-lig.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.7.2.5 X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/11/28 14:22:08, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/11/28 14:22:09, Serialize complete at 2012/11/28 14:22:09 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Cc: liguang Subject: [Qemu-devel] [PATCH]target-i386:cpu_x86_init():do clean up work 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 1.remove unused variable env 2.remove redundant error handling Signed-off-by: liguang --- target-i386/helper.c | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) diff --git a/target-i386/helper.c b/target-i386/helper.c index bf206cf..5686130 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1243,25 +1243,24 @@ int cpu_x86_get_descr_debug(CPUX86State *env, unsigned int selector, X86CPU *cpu_x86_init(const char *cpu_model) { X86CPU *cpu; - CPUX86State *env; Error *error = NULL; cpu = X86_CPU(object_new(TYPE_X86_CPU)); - env = &cpu->env; - env->cpu_model_str = cpu_model; - if (cpu_x86_register(cpu, cpu_model) < 0) { - object_delete(OBJECT(cpu)); - return NULL; - } + if (cpu_x86_register(cpu, cpu_model) < 0) + goto error_out; x86_cpu_realize(OBJECT(cpu), &error); if (error) { error_free(error); - object_delete(OBJECT(cpu)); - return NULL; + goto error_out; } + return cpu; + + error_out: + object_delete(OBJECT(cpu)); + return NULL; } #if !defined(CONFIG_USER_ONLY)