On 12.12.2023 10:12, Nicola Vetrini wrote:
> On 2023-12-12 02:42, Stefano Stabellini wrote:
>> On Mon, 11 Dec 2023, Nicola Vetrini wrote:
>>> The "return 0" after the swich statement in 'xen/arch/x86/mm.c'
>>> is unreachable because all switch clauses end with returns.
>>> However, some of them can be substituted with "break"s to allow
>>> the "return 0" outside the switch to be reachable.
>>>
>>> No functional changes.
>>
>> This is correct but makes the code inconsistent. I would either remove
>> the return 0; at the end of arch_memory_op, or do the following:
>>
>> - initialize rc to 0 at the beginning: int rc = 0;
>> - all switch clauses break instead of return;
>> - at the end: return rc;
> 
> Given the feedback on the Arm side, the first solution is likely to be 
> preferred.

I wouldn't mind either option, with
- the former ensured to be okay with all compiler versions we (still)
  support,
- the latter having the initialize rc to 0 part dropped; imo it's better
  if every case block makes sure to set the intended value explicitly.

Jan

Reply via email to