mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-18 00:54:23 -04:00
boot: refactor for R_TRY
This commit is contained in:
parent
491383c637
commit
7b6050a0cb
16 changed files with 223 additions and 623 deletions
|
@ -31,10 +31,7 @@ static Result I2cSendHandler(const u8 **cur_cmd, u8 **cur_dst, I2cSessionImpl& s
|
|||
size_t num_bytes = (**cur_cmd);
|
||||
(*cur_cmd)++;
|
||||
|
||||
Result rc = I2cDriver::Send(session, *cur_cmd, num_bytes, option);
|
||||
if (R_FAILED(rc)) {
|
||||
return rc;
|
||||
}
|
||||
R_TRY(I2cDriver::Send(session, *cur_cmd, num_bytes, option));
|
||||
(*cur_cmd) += num_bytes;
|
||||
|
||||
return ResultSuccess;
|
||||
|
@ -49,10 +46,7 @@ static Result I2cReceiveHandler(const u8 **cur_cmd, u8 **cur_dst, I2cSessionImpl
|
|||
size_t num_bytes = (**cur_cmd);
|
||||
(*cur_cmd)++;
|
||||
|
||||
Result rc = I2cDriver::Receive(session, *cur_dst, num_bytes, option);
|
||||
if (R_FAILED(rc)) {
|
||||
return rc;
|
||||
}
|
||||
R_TRY(I2cDriver::Receive(session, *cur_dst, num_bytes, option));
|
||||
(*cur_dst) += num_bytes;
|
||||
|
||||
return ResultSuccess;
|
||||
|
@ -156,10 +150,7 @@ Result I2cDriver::ExecuteCommandList(I2cSessionImpl &session, void *dst, size_t
|
|||
std::abort();
|
||||
}
|
||||
|
||||
Result rc = g_cmd_handlers[cmd](&cur_cmd, &cur_dst, session);
|
||||
if (R_FAILED(rc)) {
|
||||
return rc;
|
||||
}
|
||||
R_TRY(g_cmd_handlers[cmd](&cur_cmd, &cur_dst, session));
|
||||
}
|
||||
|
||||
return ResultSuccess;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue