[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190817033441.GD18474@bombadil.infradead.org>
Date: Fri, 16 Aug 2019 20:34:42 -0700
From: Matthew Wilcox <willy@...radead.org>
To: Zhaoyang Huang <huangzhaoyang@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Zhaoyang Huang <zhaoyang.huang@...soc.com>,
Russell King <linux@...linux.org.uk>,
Mike Rapoport <rppt@...ux.ibm.com>,
Rob Herring <robh@...nel.org>,
Florian Fainelli <f.fainelli@...il.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Doug Berger <opendmb@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arch : arm : add a criteria for pfn_valid
On Sat, Aug 17, 2019 at 11:00:13AM +0800, Zhaoyang Huang wrote:
> #ifdef CONFIG_HAVE_ARCH_PFN_VALID
> int pfn_valid(unsigned long pfn)
> {
> - return memblock_is_map_memory(__pfn_to_phys(pfn));
> + return (pfn > max_pfn) ?
> + false : memblock_is_map_memory(__pfn_to_phys(pfn));
> }
This is a really awkward way to use the ternary operator. It's easier to
read if you just:
+ if (pfn > max_pfn)
+ return 0;
return memblock_is_map_memory(__pfn_to_phys(pfn));
(if you really wanted to be clever ... er, obscure, you'd've written:
return (pfn <= max_pfn) && memblock_is_map_memory(__pfn_to_phys(pfn));
... but don't do that)
Also, why is this diverged between arm and arm64?
Powered by blists - more mailing lists