All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxc/arm: remove useless conditional in meminit
@ 2018-03-14 10:58 Wei Liu
  2018-03-14 11:01 ` George Dunlap
  2018-03-14 11:01 ` Julien Grall
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Liu @ 2018-03-14 10:58 UTC (permalink / raw)
  To: Xen-devel; +Cc: Julien Grall, Stefano Stabellini, Wei Liu

The variable named ramsize is always non-zero at that point because
there is a check for zero a few lines before.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxc/xc_dom_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index 5b9eca6087..5acb32148e 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xc_dom_arm.c
@@ -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;
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxc/arm: remove useless conditional in meminit
  2018-03-14 10:58 [PATCH] libxc/arm: remove useless conditional in meminit Wei Liu
@ 2018-03-14 11:01 ` George Dunlap
  2018-03-14 11:01 ` Julien Grall
  1 sibling, 0 replies; 4+ messages in thread
From: George Dunlap @ 2018-03-14 11:01 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, Julien Grall, Stefano Stabellini

On Wed, Mar 14, 2018 at 10:58 AM, Wei Liu <wei.liu2@citrix.com> wrote:
> 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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxc/arm: remove useless conditional in meminit
  2018-03-14 10:58 [PATCH] libxc/arm: remove useless conditional in meminit Wei Liu
  2018-03-14 11:01 ` George Dunlap
@ 2018-03-14 11:01 ` Julien Grall
  2018-03-14 11:03   ` Wei Liu
  1 sibling, 1 reply; 4+ messages in thread
From: Julien Grall @ 2018-03-14 11:01 UTC (permalink / raw)
  To: Wei Liu, Xen-devel; +Cc: Stefano Stabellini



On 03/14/2018 10:58 AM, Wei Liu wrote:
> 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,

> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
>   tools/libxc/xc_dom_arm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
> index 5b9eca6087..5acb32148e 100644
> --- a/tools/libxc/xc_dom_arm.c
> +++ b/tools/libxc/xc_dom_arm.c
> @@ -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;
>   
> 

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxc/arm: remove useless conditional in meminit
  2018-03-14 11:01 ` Julien Grall
@ 2018-03-14 11:03   ` Wei Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2018-03-14 11:03 UTC (permalink / raw)
  To: Julien Grall; +Cc: Xen-devel, Stefano Stabellini, Wei Liu

On Wed, Mar 14, 2018 at 11:01:45AM +0000, Julien Grall wrote:
> 
> 
> On 03/14/2018 10:58 AM, Wei Liu wrote:
> > 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.

Right. Please ignore this patch. -ENOCOFFEE.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-14 11:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14 10:58 [PATCH] libxc/arm: remove useless conditional in meminit Wei Liu
2018-03-14 11:01 ` George Dunlap
2018-03-14 11:01 ` Julien Grall
2018-03-14 11:03   ` Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.