LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: paulus@samba.org
Cc: ppc-dev <linuxppc-dev@ozlabs.org>, dgibson@gibson.dropbear.id.au
Subject: [PATCH] [POWERPC] fix warning in hash_native_64.c
Date: Thu, 10 May 2007 02:18:35 +1000	[thread overview]
Message-ID: <20070510021835.97209267.sfr@canb.auug.org.au> (raw)


arch/powerpc/mm/hash_native_64.c: In function 'native_hpte_clear':
arch/powerpc/mm/hash_native_64.c:353: warning: 'avpn' may be used uninitialized in this function

The change is really to BUG_ON the invers of the if condition and
outdent all the following code.  The comment above this imples that
changing this so it does the BUG_ON() is a reasonable fix.

David Gibson suggested using BUG_ON here.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/mm/hash_native_64.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index 7b7fe2d..531a5ab 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -16,6 +16,7 @@
 #include <linux/bitops.h>
 #include <linux/threads.h>
 #include <linux/smp.h>
+#include <linux/bug.h>
 
 #include <asm/abs_addr.h>
 #include <asm/machdep.h>
@@ -389,18 +390,19 @@ static void hpte_decode(hpte_t *hpte, unsigned long slot,
 		avpnm_bits = __ilog2_u64(mmu_psize_defs[size].avpnm) + 1;
 	else
 		avpnm_bits = 0;
-	if (shift - avpnm_bits <= 23) {
-		avpn = HPTE_V_AVPN_VAL(hpte_v) << 23;
 
-		if (shift < 23) {
-			unsigned long vpi, pteg;
+	BUG_ON(!(shift - avpnm_bits <= 23));
 
-			pteg = slot / HPTES_PER_GROUP;
-			if (hpte_v & HPTE_V_SECONDARY)
-				pteg = ~pteg;
-			vpi = ((avpn >> 28) ^ pteg) & htab_hash_mask;
-			avpn |= (vpi << mmu_psize_defs[size].shift);
-		}
+	avpn = HPTE_V_AVPN_VAL(hpte_v) << 23;
+
+	if (shift < 23) {
+		unsigned long vpi, pteg;
+
+		pteg = slot / HPTES_PER_GROUP;
+		if (hpte_v & HPTE_V_SECONDARY)
+			pteg = ~pteg;
+		vpi = ((avpn >> 28) ^ pteg) & htab_hash_mask;
+		avpn |= (vpi << mmu_psize_defs[size].shift);
 	}
 
 	*va = avpn;
-- 
1.5.1.3

                 reply	other threads:[~2007-05-09 16:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070510021835.97209267.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=dgibson@gibson.dropbear.id.au \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox