Skip to contentSkip to conversation

remove unnecessary check code for hole_align

PATCH In review Dave Young 2 participants 3 messages Nov 8, 2011 – Nov 9, 2011

Subsystems (2)
lore
Share & tools
lore

Dave Young

author
#0 lore raw

PATCH 1/1 remove unnecessary check code for hole_align

hole_align == 0 check is not neccesary, because it will be set to pagesize if it's zero. Just remove it here.

---
 kexec/kexec.c |    4 ----
 1 file changed, 4 deletions(-)
kexec/kexec.c +0 -4
Index: kexec-tools/kexec/kexec.c
===================================================================
@@ -203,10 +203,6 @@ unsigned long locate_hole(struct kexec_i
 	/* Set an intial invalid value for the hole base */
 	hole_base = ULONG_MAX;
 
-	/* Ensure I have a sane alignment value */
-	if (hole_align == 0) {
-		hole_align = 1;
-	}
 	/* Align everything to at least a page size boundary */
 	if (hole_align < (unsigned long)getpagesize()) {
 		hole_align = getpagesize();

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw
Quoted 3 lines · Dave Young

hole_align == 0 check is not neccesary, because it will be set to pagesize if it's zero. Just remove it here.

Hi Dave,

it looks like the if condition can never be true due to hole_base being set to a non-zero value on the previous line.

Which is a long way of saying, I like your patch.

Quoted 21 lines
---
 kexec/kexec.c |    4 ----
 1 file changed, 4 deletions(-)

Index: kexec-tools/kexec/kexec.c
===================================================================

kexec/kexec.c +0 -4
@@ -203,10 +203,6 @@ unsigned long locate_hole(struct kexec_i
 	/* Set an intial invalid value for the hole base */
 	hole_base = ULONG_MAX;
 
-	/* Ensure I have a sane alignment value */
-	if (hole_align == 0) {
-		hole_align = 1;
-	}
 	/* Align everything to at least a page size boundary */
 	if (hole_align < (unsigned long)getpagesize()) {
 		hole_align = getpagesize();
Quoted 5 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw
Quoted 5 lines · Simon Horman
Quoted 3 lines · Dave Young

hole_align == 0 check is not neccesary, because it will be set to pagesize if it's zero. Just remove it here.

Quoted 7 lines

Hi Dave,

it looks like the if condition can never be true due to hole_base being set to a non-zero value on the previous line.

Which is a long way of saying, I like your patch.

Hi Dave,

I have applied your patch to my kexec-tools tree on github.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec