libxc/arm: remove useless conditional in meminit
PATCH 1/1 libxc/arm: remove useless conditional in meminit
The variable named ramsize is always non-zero at that point because there is a check for zero a few lines before.
--- tools/libxc/xc_dom_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_dom_arm.c +1 -1
@@ -425,7 +425,7 @@ static int meminit(struct xc_dom_image *dom)if ( rc )return rc; -for ( i =0 ; ramsize && i <GUEST_RAM_BANKS ; i++ ) +for ( i =0 ; i <GUEST_RAM_BANKS ; i++ ) {uint64_t banksize = ramsize > bankmax[i] ? bankmax[i] : ramsize;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 2 lines · Wei Liu
The variable named ramsize is always non-zero at that point because there is a check for zero a few lines before.
But this is a loop, and ramsize is modified during the loop. if bankmax[i] > ramsize, then banksize is set to ramsize, and the loop should terminate next time around.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 2 lines · Wei Liu
The variable named ramsize is always non-zero at that point because there is a check for zero a few lines before.
The body of the loop has:
ramsize -= ...
We want to exit the loop either when we have no more banks left or we fulfilled all the RAM requested.
Cheers,
Quoted 20 lines
Signed-off-by Wei Liu <[email protected]>--- tools/libxc/xc_dom_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libxc/xc_dom_arm.c +1
-1@@ -425,7 +425,7 @@ static int meminit(struct xc_dom_image *dom)if ( rc )return rc; -for ( i =0 ; ramsize && i <GUEST_RAM_BANKS ; i++ ) +for ( i =0 ; i <GUEST_RAM_BANKS ; i++ ) {uint64_t banksize = ramsize > bankmax[i] ? bankmax[i] : ramsize;
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 6 lines · Julien Grall
Quoted 2 lines · Wei Liu
The variable named ramsize is always non-zero at that point because there is a check for zero a few lines before.
Quoted 6 lines
The body of the loop has:
ramsize -= ...
We want to exit the loop either when we have no more banks left or we fulfilled all the RAM requested.
Right. Please ignore this patch. -ENOCOFFEE.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel