Skip to contentSkip to conversation

mm/bootmem.c: remove unused 'limit' variable

PATCH In review Luiz Capitulino 2 participants 3 messages Nov 21, 2013 – Nov 22, 2013 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/bootmem.c: remove unused 'limit' variable

---
 mm/bootmem.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
mm/bootmem.c +2 -6
index 90bd350..31d303e 100644
@@ -655,9 +655,7 @@ restart:
 void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align,
 					unsigned long goal)
 {
-	unsigned long limit = 0;
-
-	return ___alloc_bootmem_nopanic(size, align, goal, limit);
+	return ___alloc_bootmem_nopanic(size, align, goal, 0);
 }
 
 static void * __init ___alloc_bootmem(unsigned long size, unsigned long align,
@@ -691,9 +689,7 @@ static void * __init ___alloc_bootmem(unsigned long size, unsigned long align,
 void * __init __alloc_bootmem(unsigned long size, unsigned long align,
 			      unsigned long goal)
 {
-	unsigned long limit = 0;
-
-	return ___alloc_bootmem(size, align, goal, limit);
+	return ___alloc_bootmem(size, align, goal, 0);
 }
 
 void * __init ___alloc_bootmem_node_nopanic(pg_data_t *pgdat,
Signature · 7 lines
1.8.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

mm/bootmem.c restart: · line 659

Quoted 9 lines · Luiz Capitulino
mm/bootmem.c +1 -3
@@ -655,9 +655,7 @@ restart:
 void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align,
 					unsigned long goal)
 {
-	unsigned long limit = 0;
-
-	return ___alloc_bootmem_nopanic(size, align, goal, limit);
+	return ___alloc_bootmem_nopanic(size, align, goal, 0);
 }

FWIW, I like those. The way you leave it:

	return ___alloc_bootmem_nopanic(size, align, goal, 0);

the 0 is a magic number that you have to go look up the declaration of ___alloc_bootmem_nopanic() to decipher, or you have to add a comment to it in some way.

I find it much more readable to have an 'unused' variable like that.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 13 lines · On Thu, 21 Nov 2013 14:05:42 -0800 Dave Hansen <[email protected]> wrote:

mm/bootmem.c restart: · line 659

Quoted 9 lines · Luiz Capitulino
mm/bootmem.c +1 -3
@@ -655,9 +655,7 @@ restart:
 void * __init __alloc_bootmem_nopanic(unsigned long size, unsigned long align,
 					unsigned long goal)
 {
-	unsigned long limit = 0;
-
-	return ___alloc_bootmem_nopanic(size, align, goal, limit);
+	return ___alloc_bootmem_nopanic(size, align, goal, 0);
 }

FWIW, I like those. The way you leave it:

Quoted 7 lines
	return ___alloc_bootmem_nopanic(size, align, goal, 0);

the 0 is a magic number that you have to go look up the declaration of ___alloc_bootmem_nopanic() to decipher, or you have to add a comment to it in some way.

I find it much more readable to have an 'unused' variable like that.

Got it. I was reading that code and thought 'limit' was a leftover, so I posted the patch...

Btw, I also have a patch consitfying some zone access functions parameters that are read-only. Wondering if anyone will object to such a change? Or maybe I should just stop doing trivial patches :)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>