linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: spang@chromium.org (Michael Spang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: Only initialize max_mapnr when using flatmem
Date: Mon, 22 Oct 2012 15:51:54 -0400	[thread overview]
Message-ID: <1350935514-27422-1-git-send-email-spang@chromium.org> (raw)

The expression used to initialize max_mapnr is not appropriate for
sparsemem, since mem_map is NULL and pfn_to_page() only works on valid
pages. This patch leaves max_mapnr uninitialized for sparsemem.

For flatmem, the expression simplifies to copying max_pfn.

Signed-off-by: Michael Spang <spang@chromium.org>
---
 arch/arm/mm/init.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

I'm not sure we need this variable it all - it looks like there are no
users.

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c21d06c..9b72e6f 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -600,7 +600,9 @@ void __init mem_init(void)
 	extern u32 itcm_end;
 #endif
 
-	max_mapnr   = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
+#ifdef CONFIG_FLATMEM
+	max_mapnr = max_pfn;
+#endif
 
 	/* this will put all unused low memory onto the freelists */
 	free_unused_memmap(&meminfo);
-- 
1.7.7.3

             reply	other threads:[~2012-10-22 19:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 19:51 Michael Spang [this message]
2013-01-08 16:46 ` [PATCH] ARM: Only initialize max_mapnr when using flatmem Russell King - ARM Linux
2013-04-03 16:37   ` Russell King - ARM Linux

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=1350935514-27422-1-git-send-email-spang@chromium.org \
    --to=spang@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).