On 06.04.2023 01:02, Andrew Cooper wrote:
> On 05/04/2023 9:56 am, Jan Beulich wrote:
>> On 04.04.2023 18:06, Sergey Dyasli wrote:
>>> --- a/tools/libs/ctrl/xc_misc.c
>>> +++ b/tools/libs/ctrl/xc_misc.c
>>> @@ -243,6 +243,24 @@ int xc_get_cpu_version(xc_interface *xch, struct 
>>> xenpf_pcpu_version *cpu_ver)
>>>      return 0;
>>>  }
>>>  
>>> +int xc_get_ucode_revision(xc_interface *xch,
>>> +                          struct xenpf_ucode_revision *ucode_rev)
>>> +{
>>> +    int ret;
>>> +    struct xen_platform_op op = {
>>> +        .cmd = XENPF_get_ucode_revision,
>>> +        .u.ucode_revision.cpu = ucode_rev->cpu,
>>> +    };
>>> +
>>> +    ret = do_platform_op(xch, &op);
>>> +    if ( ret != 0 )
>>> +        return ret;
>> Is there anything wrong with omitting this if() and ...
>>
>>> +    *ucode_rev = op.u.ucode_revision;
>>> +
>>> +    return 0;
>> ... using "return ret" here?
> 
> Conceptually, yes.  *ucode_rev oughtn't to be written to on failure.
> 
> More importantly though, what Sergey wrote is consistent with the vast
> majority of libxc, and consistency is far more important than a marginal
> perf improvement which you won't be able to measure.

My remark was entirely unrelated to performance, and instead solely to
(source) code size.

Jan

Reply via email to