mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 08:42:45 +01:00
k_address_arbiter: Unfold R_UNLESS macros
Allows for more descriptive error messages and also doesn't hide control-path exit returns from the reader.
This commit is contained in:
parent
b8fc74d74d
commit
40ab2b9348
1 changed files with 8 additions and 5 deletions
|
@ -118,9 +118,10 @@ ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32
|
|||
|
||||
// Check the userspace value.
|
||||
s32 user_value{};
|
||||
R_UNLESS(UpdateIfEqual(system, &user_value, addr, value, value + 1),
|
||||
Svc::ResultInvalidCurrentMemory);
|
||||
|
||||
if (!UpdateIfEqual(system, &user_value, addr, value, value + 1)) {
|
||||
LOG_ERROR(Kernel, "Invalid current memory!");
|
||||
return Svc::ResultInvalidCurrentMemory;
|
||||
}
|
||||
if (user_value != value) {
|
||||
return Svc::ResultInvalidState;
|
||||
}
|
||||
|
@ -186,8 +187,10 @@ ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32
|
|||
succeeded = ReadFromUser(system, &user_value, addr);
|
||||
}
|
||||
|
||||
R_UNLESS(succeeded, Svc::ResultInvalidCurrentMemory);
|
||||
|
||||
if (!succeeded) {
|
||||
LOG_ERROR(Kernel, "Invalid current memory!");
|
||||
return Svc::ResultInvalidCurrentMemory;
|
||||
}
|
||||
if (user_value != value) {
|
||||
return Svc::ResultInvalidState;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue