From patchwork Mon Aug 5 18:24:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 18777 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f72.google.com (mail-qe0-f72.google.com [209.85.128.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C6C98246D0 for ; Mon, 5 Aug 2013 18:24:30 +0000 (UTC) Received: by mail-qe0-f72.google.com with SMTP id a11sf4985401qen.3 for ; Mon, 05 Aug 2013 11:24:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-removed-original-auth:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=FcdPx2wwxidljnrwpSZC4Mv7oDKO0IAkWTvr24bcI+Q=; b=SplKBdJcENcSMa9G1mZVhME/bppGOoQ9wiz6zFMHnLrzWPXOQLybhVsuSpmSz2hRGD gClG0J7SnKSU4O8thNzc54SMjo/fIzHEWLuKzkyG96ORcMc7f9zg71unODA8qxXIAjKy xgTXr2A2dWoFvVOdx1ZX6qj4mwR/KTiOUrde5X5AueW6UcAxX1zCO1BUPTqLR+q06+YV qGfu0kUCzmhR68Uqn0sybQtjVNOUI2uxr9Z9X3pCMwVU8nRIlMh/g0MLdnxfV0hYLGY5 4y0LNQVpm/R0xdLAON3VP6DvVjxm0UFnQtIQM6J99VajiE8VWxFjlU92+2SGgQQ7CBfS 0YmQ== X-Received: by 10.58.216.100 with SMTP id op4mr1850554vec.15.1375727070403; Mon, 05 Aug 2013 11:24:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.116.139 with SMTP id jw11ls2777910qeb.21.gmail; Mon, 05 Aug 2013 11:24:30 -0700 (PDT) X-Received: by 10.52.22.45 with SMTP id a13mr2143145vdf.53.1375727070317; Mon, 05 Aug 2013 11:24:30 -0700 (PDT) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id to9si78229vdc.71.2013.08.05.11.24.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 Aug 2013 11:24:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.42; Received: by mail-vb0-f42.google.com with SMTP id e12so3176747vbg.1 for ; Mon, 05 Aug 2013 11:24:30 -0700 (PDT) X-Received: by 10.220.198.133 with SMTP id eo5mr6202671vcb.24.1375727070143; Mon, 05 Aug 2013 11:24:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.11.8 with SMTP id pc8csp104292vcb; Mon, 5 Aug 2013 11:24:29 -0700 (PDT) X-Received: by 10.180.187.235 with SMTP id fv11mr7533303wic.65.1375727069170; Mon, 05 Aug 2013 11:24:29 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id hm6si164514wjb.126.2013.08.05.11.24.28 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 05 Aug 2013 11:24:29 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1V6PSF-0005lL-6b; Mon, 05 Aug 2013 19:24:27 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-trivial@nongnu.org, Jia Liu Subject: [PATCH] hw/openrisc/openrisc_sim: Avoid using uninitialised variable 'entry' Date: Mon, 5 Aug 2013 19:24:27 +0100 Message-Id: <1375727067-22126-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQmqBZ4AnnB0Pbs+tMHZUx35eb+GAEm/eD8J2sfI/u5IaEYAU+M13adt+KZLvza3n9sXIUVi X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , clang warns that cpu_openrisc_load_kernel() can use 'entry' uninitialized: hw/openrisc/openrisc_sim.c:69:9: error: variable 'entry' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized] if (kernel_filename && !qtest_enabled()) { ^~~~~~~~~~~~~~~ hw/openrisc/openrisc_sim.c:91:19: note: uninitialized use occurs here cpu->env.pc = entry; ^~~~~ Fix this by not attempting to change the CPU's starting PC unless we actually loaded a kernel. Signed-off-by: Peter Maydell Reviewed-by: Jia Liu --- hw/openrisc/openrisc_sim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c index a08f27c..4595fa9 100644 --- a/hw/openrisc/openrisc_sim.c +++ b/hw/openrisc/openrisc_sim.c @@ -86,9 +86,9 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size, kernel_filename); exit(1); } - } - cpu->env.pc = entry; + cpu->env.pc = entry; + } } static void openrisc_sim_init(QEMUMachineInitArgs *args)