Skip to content

Commit e22defe

Browse files
Kirtika Ruchandanigregkh
authored andcommitted
drivers/base/memory.c: Remove unused 'first_page' variable
Commit 71fbd55 ("memory-hotplug: remove redundant call of page_to_pfn") introduced an optimization that rendered 'struct page* first_page' useless in memory_block_action(). Compiling with W=1 gives the following warning, fix it. drivers/base/memory.c: In function ‘memory_block_action’: drivers/base/memory.c:229:15: warning: variable ‘first_page’ set but not used [-Wunused-but-set-variable] struct page *first_page; ^ This is a harmeless warning and is only being fixed to reduce the noise with W=1 in the kernel. The call to pfn_to_page() has no side effects and is safe to remove. Fixes: 71fbd55 ("memory-hotplug: remove redundant call of page_to_pfn") Cc: Zhang Zhen <zhenzhang.zhang@huawei.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Kirtika Ruchandani <kirtika@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2027cbc commit e22defe

1 file changed

Lines changed: 0 additions & 2 deletions

File tree

‎drivers/base/memory.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,9 @@ memory_block_action(unsigned long phys_index, unsigned long action, int online_t
226226
{
227227
unsigned long start_pfn;
228228
unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
229-
struct page *first_page;
230229
int ret;
231230

232231
start_pfn = section_nr_to_pfn(phys_index);
233-
first_page = pfn_to_page(start_pfn);
234232

235233
switch (action) {
236234
case MEM_ONLINE:

0 commit comments

Comments
 (0)