Wei Liu writes ("[PATCH] libxc: initialise rc to -1 at the beginning of 
meminit_hvm"):
> Variable rc is only set either inside a loop or inside some if
> statements. To avoid confuse gcc with stricter setting we set rc to -1
> at the beginning.

Is this really the best way to fix this ?

AFAICT the problem arises only for this code:

    if ( rc != 0 )
    {
        DOMPRINTF("Could not allocate memory for HVM guest.");
        goto error_out;
    }

which occurs after the loop.  But that path happens only if

        if ( rc != 0 )
            break;

is executed inside the loop.

If the error case was moved into the loop, there would be no need for
the separate test of rc (which is confusing to humans as well as to
the compiler).

Do you agree ?

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to