linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Christophe Leroy" <christophe.leroy@c-s.fr>,
	linuxppc-dev@lists.ozlabs.org, "Cédric Le Goater" <clg@kaod.org>
Subject: [PATCH 2/7] powerpc/prom: Fix W=1 compile warning
Date: Thu, 10 Sep 2020 23:02:45 +0200	[thread overview]
Message-ID: <20200910210250.1962595-3-clg@kaod.org> (raw)
In-Reply-To: <20200910210250.1962595-1-clg@kaod.org>

arch/powerpc/kernel/prom.c: In function ‘early_reserve_mem’:
arch/powerpc/kernel/prom.c:625:10: error: variable ‘reserve_map’ set but not used [-Werror=unused-but-set-variable]
  __be64 *reserve_map;
          ^~~~~~~~~~~
cc1: all warnings being treated as errors

Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 arch/powerpc/kernel/prom.c | 51 +++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index d8a2fb87ba0c..4bae9ebc7d0b 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -622,11 +622,6 @@ static void __init early_reserve_mem_dt(void)
 
 static void __init early_reserve_mem(void)
 {
-	__be64 *reserve_map;
-
-	reserve_map = (__be64 *)(((unsigned long)initial_boot_params) +
-			fdt_off_mem_rsvmap(initial_boot_params));
-
 	/* Look for the new "reserved-regions" property in the DT */
 	early_reserve_mem_dt();
 
@@ -639,28 +634,34 @@ static void __init early_reserve_mem(void)
 	}
 #endif /* CONFIG_BLK_DEV_INITRD */
 
-#ifdef CONFIG_PPC32
-	/* 
-	 * Handle the case where we might be booting from an old kexec
-	 * image that setup the mem_rsvmap as pairs of 32-bit values
-	 */
-	if (be64_to_cpup(reserve_map) > 0xffffffffull) {
-		u32 base_32, size_32;
-		__be32 *reserve_map_32 = (__be32 *)reserve_map;
-
-		DBG("Found old 32-bit reserve map\n");
-
-		while (1) {
-			base_32 = be32_to_cpup(reserve_map_32++);
-			size_32 = be32_to_cpup(reserve_map_32++);
-			if (size_32 == 0)
-				break;
-			DBG("reserving: %x -> %x\n", base_32, size_32);
-			memblock_reserve(base_32, size_32);
+	if (IS_ENABLED(CONFIG_PPC32)) {
+		__be64 *reserve_map;
+
+		reserve_map = (__be64 *)(((unsigned long)initial_boot_params) +
+				 fdt_off_mem_rsvmap(initial_boot_params));
+
+		/*
+		 * Handle the case where we might be booting from an
+		 * old kexec image that setup the mem_rsvmap as pairs
+		 * of 32-bit values
+		 */
+		if (be64_to_cpup(reserve_map) > 0xffffffffull) {
+			u32 base_32, size_32;
+			__be32 *reserve_map_32 = (__be32 *)reserve_map;
+
+			DBG("Found old 32-bit reserve map\n");
+
+			while (1) {
+				base_32 = be32_to_cpup(reserve_map_32++);
+				size_32 = be32_to_cpup(reserve_map_32++);
+				if (size_32 == 0)
+					break;
+				DBG("reserving: %x -> %x\n", base_32, size_32);
+				memblock_reserve(base_32, size_32);
+			}
+			return;
 		}
-		return;
 	}
-#endif
 }
 
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
-- 
2.25.4


  parent reply	other threads:[~2020-09-10 21:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 21:02 [PATCH 0/7] powerpc: Fix a few W=1 compile warnings Cédric Le Goater
2020-09-10 21:02 ` [PATCH 1/7] powerpc/sysfs: Fix W=1 compile warning Cédric Le Goater
2020-09-11  5:26   ` Christophe Leroy
2020-09-11  9:10     ` Cédric Le Goater
2020-09-10 21:02 ` Cédric Le Goater [this message]
2020-09-11  5:33   ` [PATCH 2/7] powerpc/prom: " Christophe Leroy
2020-09-11  6:01     ` Cédric Le Goater
2020-09-10 21:02 ` [PATCH 3/7] powerpc/sstep: " Cédric Le Goater
2020-09-11  5:38   ` Christophe Leroy
2020-09-11  5:59     ` Cédric Le Goater
2020-09-11  6:04       ` Christophe Leroy
2020-09-10 21:02 ` [PATCH 4/7] powerpc/xive: " Cédric Le Goater
2020-09-11  5:40   ` Christophe Leroy
2020-09-10 21:02 ` [PATCH 5/7] powerpc/powernv/pci: " Cédric Le Goater
2020-09-11  5:41   ` Christophe Leroy
2020-09-11  6:32   ` Oliver O'Halloran
2020-09-10 21:02 ` [PATCH 6/7] powerpc/perf: " Cédric Le Goater
2020-09-11  5:42   ` Christophe Leroy
2020-09-10 21:02 ` [PATCH 7/7] powerpc/32: " Cédric Le Goater
2020-09-11  5:49   ` Christophe Leroy

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=20200910210250.1962595-3-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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;
as well as URLs for NNTP newsgroup(s).