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
|
@ -118,9 +118,10 @@ ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32
|
||||||
|
|
||||||
// Check the userspace value.
|
// Check the userspace value.
|
||||||
s32 user_value{};
|
s32 user_value{};
|
||||||
R_UNLESS(UpdateIfEqual(system, &user_value, addr, value, value + 1),
|
if (!UpdateIfEqual(system, &user_value, addr, value, value + 1)) {
|
||||||
Svc::ResultInvalidCurrentMemory);
|
LOG_ERROR(Kernel, "Invalid current memory!");
|
||||||
|
return Svc::ResultInvalidCurrentMemory;
|
||||||
|
}
|
||||||
if (user_value != value) {
|
if (user_value != value) {
|
||||||
return Svc::ResultInvalidState;
|
return Svc::ResultInvalidState;
|
||||||
}
|
}
|
||||||
|
@ -186,8 +187,10 @@ ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32
|
||||||
succeeded = ReadFromUser(system, &user_value, addr);
|
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) {
|
if (user_value != value) {
|
||||||
return Svc::ResultInvalidState;
|
return Svc::ResultInvalidState;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue