On 9/12/21 2:37 PM, Alexander Graf wrote:

On 12.09.21 23:20, Richard Henderson wrote:
On 9/12/21 1:36 PM, Alexander Graf wrote:
I think the callsites would be clearer if you made the function
return true for "PSCI call handled", false for "not recognised,
give the guest an UNDEF". Code like
           if (hvf_handle_psci_call(cpu)) {
               stuff;
           }

looks like the 'stuff' is for the "psci call handled" case,
which at the moment it isn't.


This function merely follows standard C semantics along the lines of "0
means success, !0 is error". Isn't that what you would usually expect?

No, not really.  I expect stuff that returns error codes to return
negative integers on failure.  I expect stuff that returns a boolean
success/failure to return true on success.


Fair, I'll change it to return -1 then. Thanks!

Not quite the point I was making. If the only two return values are -1/0, then bool false/true is in fact more appropriate.


r~

Reply via email to