From patchwork Thu Aug 16 16:59:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 178050 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 AB1EF2C009F for ; Fri, 17 Aug 2012 02:58:26 +1000 (EST) Received: from localhost ([::1]:56769 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T23Oq-0000uG-R8 for incoming@patchwork.ozlabs.org; Thu, 16 Aug 2012 12:58:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T23Oh-0000u9-Vk for qemu-devel@nongnu.org; Thu, 16 Aug 2012 12:58:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T23Oh-0002kX-3Z for qemu-devel@nongnu.org; Thu, 16 Aug 2012 12:58:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T23Og-0002kM-SB for qemu-devel@nongnu.org; Thu, 16 Aug 2012 12:58:15 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7GGwABa002232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 16 Aug 2012 12:58:10 -0400 Received: from blackpad.lan.raisama.net (vpn1-6-48.gru2.redhat.com [10.97.6.48]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q7GGw9Xx021399; Thu, 16 Aug 2012 12:58:10 -0400 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id D11F6201196; Thu, 16 Aug 2012 13:59:14 -0300 (BRT) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 16 Aug 2012 13:59:07 -0300 Message-Id: <1345136352-10756-9-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.23 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 08/13] cpu_x86_register: always initialize 'name' and 'features' 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 It's safer to initialize them than require that compat_normalize_cpu_model() always initialize them, even on errors. Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 0bf62da..c48de43 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1503,8 +1503,8 @@ int cpu_x86_register(X86CPU *cpu, const char *cpu_model) { X86CPUDefinition def1, *def = &def1; Error *error = NULL; - QDict *features; - char *name; + QDict *features = NULL; + char *name = NULL; /* for CPU subclasses should go into cpu_x86_init() before object_new() */ compat_normalize_cpu_model(cpu_model, &name, &features, &error);