[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-next v2 09/10] x86/domain: move PV specific code to pv/domain.c



>>> On 25.04.17 at 16:52, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 25/04/17 14:52, Wei Liu wrote:
>> +
>> +    for_each_vcpu( d, v )
>> +    {
>> +        rc = setup_compat_arg_xlat(v);
>> +        if ( !rc )
>> +            rc = setup_compat_l4(v);
>> +
>> +        if ( rc )
>> +            goto undo_and_fail;
> 
> This is odd structuring.  Care to rearrange it with two goto's, rather
> than inverting the first rc check?

I don't see anything odd about it - just like with preferably limiting
the number of return statements, I think limiting the number of
goto-s is quite desirable. What if the second if()'s body had more
than just a goto? I'd certainly prefer the code structure above in
that case over _adding_ a goto into this second if(). Further down
the same two functions are being called, pointlessly using two
goto-s. If you really wanted to get rid of the inverted first
condition, then how about if ( (rc = ...) || (rc = ...) ) ?

Jan


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.