From patchwork Mon Sep 10 08:40:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King - ARM Linux X-Patchwork-Id: 1430431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 58F2CE0000 for ; Mon, 10 Sep 2012 08:46:57 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TAzaD-00037G-KQ; Mon, 10 Sep 2012 08:43:06 +0000 Received: from [2002:4e20:1eda::1] (helo=caramon.arm.linux.org.uk) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TAzXn-0001jV-65 for linux-arm-kernel@lists.infradead.org; Mon, 10 Sep 2012 08:40:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=caramon; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=TLhUN3VHmFMYxonTC6ouuhBKLbSY1ugeudSRwcYpjp8=; b=kS/PoZfmX1FTknRH3KSFdbMc7i+8tm6pkTtkOQfKGl6vuJ5G79y1901hB+JIJqJ4r4iR6AgKBh6c9cmAkOFI622hMo/7eAms/Jq+vhKuoBnx/BUa/E5ocOoDYISlgYR/XcDY7Z8E/Asc/mjXXm9lqxWd2cMyU9BiYzBDXKp5Z90=; Received: from n2100.arm.linux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:39493) by caramon.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1TAzXe-00068J-Oz; Mon, 10 Sep 2012 09:40:27 +0100 Received: from linux by n2100.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1TAzXd-0007Xi-KA; Mon, 10 Sep 2012 09:40:25 +0100 Date: Mon, 10 Sep 2012 09:40:25 +0100 From: Russell King - ARM Linux To: Chanho Min Subject: Re: [PATCH] ARM: Fix build warning in do_alignment. Message-ID: <20120910084025.GP13739@n2100.arm.linux.org.uk> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.0 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.8 RDNS_NONE Delivered to internal network by a host with no rDNS 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid Cc: Stephen Warren , Nicolas Pitre , linux-kernel@vger.kernel.org, David Howells , H Hartley Sweeten , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Mon, Sep 10, 2012 at 12:25:15PM +0900, Chanho Min wrote: > Fix the following build warning: > > arch/arm/mm/alignment.c: In function 'do_alignment': > arch/arm/mm/alignment.c:327:15: warning: 'offset.un' may be used > uninitialized in this function [-Wuninitialized] > arch/arm/mm/alignment.c:749:21: note: 'offset.un' was declared here > > Signed-off-by: Chanho Min The compiler is being silly - notice that it is saying "may" not "is". In this case, it will not be uninitialized prior to use. What it's caused by is do_alignment_t32_to_handler(), and its assignment through a pointer of this variable. You can see that this is the cause because the patch below fixes the warning. It's all about whether gcc can prove that the variable is or is not assigned. It has one warning for the 'provably not assigned' case, and another for the 'can't prove that it is always assigned' case. Anyway, normally we don't fix warnings where the compiler is wrong (but we encourage the compiler guys to fix the compiler instead.) arch/arm/mm/alignment.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c index 6d6790e..5ce7733 100644 --- a/arch/arm/mm/alignment.c +++ b/arch/arm/mm/alignment.c @@ -699,7 +699,6 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs, unsigned long instr = *pinstr; u16 tinst1 = (instr >> 16) & 0xffff; u16 tinst2 = instr & 0xffff; - poffset->un = 0; switch (tinst1 & 0xffe0) { /* A6.3.5 Load/Store multiple */ @@ -854,9 +853,10 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) break; case 0x08000000: /* ldm or stm, or thumb-2 32bit instruction */ - if (thumb2_32b) + if (thumb2_32b) { + offset.un = 0; handler = do_alignment_t32_to_handler(&instr, regs, &offset); - else + } else handler = do_alignment_ldmstm; break;