ams: globally prefer R_RETURN to return for ams::Result

This commit is contained in:
Michael Scire 2022-03-26 14:48:33 -07:00
parent dd78ede99f
commit bbf22b4c60
325 changed files with 1955 additions and 1993 deletions

View file

@ -176,27 +176,27 @@ namespace ams::usb {
/* Check that we have a service. */
AMS_ABORT_UNLESS(m_ds_service != nullptr);
return m_ds_service->GetState(out);
R_RETURN(m_ds_service->GetState(out));
}
Result DsClient::ClearDeviceData() {
return m_ds_service->ClearDeviceData();
R_RETURN(m_ds_service->ClearDeviceData());
}
Result DsClient::AddUsbStringDescriptor(u8 *out_index, UsbStringDescriptor *desc) {
return m_ds_service->AddUsbStringDescriptor(out_index, sf::InBuffer(reinterpret_cast<const u8 *>(desc), sizeof(*desc)));
R_RETURN(m_ds_service->AddUsbStringDescriptor(out_index, sf::InBuffer(reinterpret_cast<const u8 *>(desc), sizeof(*desc))));
}
Result DsClient::DeleteUsbStringDescriptor(u8 index) {
return m_ds_service->DeleteUsbStringDescriptor(index);
R_RETURN(m_ds_service->DeleteUsbStringDescriptor(index));
}
Result DsClient::SetUsbDeviceDescriptor(UsbDeviceDescriptor *desc, UsbDeviceSpeed speed) {
return m_ds_service->SetUsbDeviceDescriptor(sf::InBuffer(reinterpret_cast<const u8 *>(desc), sizeof(*desc)), speed);
R_RETURN(m_ds_service->SetUsbDeviceDescriptor(sf::InBuffer(reinterpret_cast<const u8 *>(desc), sizeof(*desc)), speed));
}
Result DsClient::SetBinaryObjectStore(u8 *data, int size) {
return m_ds_service->SetBinaryObjectStore(sf::InBuffer(reinterpret_cast<const u8 *>(data), size));
R_RETURN(m_ds_service->SetBinaryObjectStore(sf::InBuffer(reinterpret_cast<const u8 *>(data), size)));
}
Result DsClient::AddInterface(DsInterface *intf, sf::SharedPointer<ds::IDsInterface> *out_srv, uint8_t bInterfaceNumber) {
@ -326,7 +326,7 @@ namespace ams::usb {
}
Result DsInterface::AppendConfigurationData(UsbDeviceSpeed speed, void *data, u32 size) {
return m_interface->AppendConfigurationData(m_interface_num, speed, sf::InBuffer(data, size));
R_RETURN(m_interface->AppendConfigurationData(m_interface_num, speed, sf::InBuffer(data, size)));
}
bool DsInterface::IsInitialized() {
@ -350,7 +350,7 @@ namespace ams::usb {
/* Check that we have a service. */
AMS_ABORT_UNLESS(m_interface != nullptr);
return m_interface->GetSetupPacket(sf::OutBuffer(out, sizeof(*out)));
R_RETURN(m_interface->GetSetupPacket(sf::OutBuffer(out, sizeof(*out))));
}
Result DsInterface::Enable() {
@ -561,12 +561,12 @@ namespace ams::usb {
result = this->CtrlIn(nullptr, nullptr, 0);
}
/* If we failed, stall. */
/* If we fail, stall. */
if (R_FAILED(result)) {
result = this->CtrlStall();
}
return result;
R_RETURN(result);
}
Result DsInterface::CtrlWrite(u32 *out_transferred, void *dst, u32 size) {
@ -589,7 +589,7 @@ namespace ams::usb {
result = this->CtrlStall();
}
return result;
R_RETURN(result);
}
Result DsInterface::CtrlDone() {
@ -607,7 +607,7 @@ namespace ams::usb {
result = this->CtrlStall();
}
return result;
R_RETURN(result);
}
Result DsInterface::CtrlStall() {
@ -623,7 +623,7 @@ namespace ams::usb {
/* Check that we have a service. */
AMS_ABORT_UNLESS(m_interface != nullptr);
return m_interface->CtrlStall();
R_RETURN(m_interface->CtrlStall());
}
Result DsEndpoint::Initialize(DsInterface *interface, u8 bEndpointAddress) {
@ -783,7 +783,7 @@ namespace ams::usb {
/* Check that we have a service. */
AMS_ABORT_UNLESS(m_endpoint != nullptr);
return m_endpoint->GetUrbReport(out);
R_RETURN(m_endpoint->GetUrbReport(out));
}
Result DsEndpoint::Cancel() {
@ -796,7 +796,7 @@ namespace ams::usb {
/* Check that we have a service. */
AMS_ABORT_UNLESS(m_endpoint != nullptr);
return m_endpoint->Cancel();
R_RETURN(m_endpoint->Cancel());
}
Result DsEndpoint::SetZeroLengthTransfer(bool zlt) {
@ -809,7 +809,7 @@ namespace ams::usb {
/* Check that we have a service. */
AMS_ABORT_UNLESS(m_endpoint != nullptr);
return m_endpoint->SetZlt(zlt);
R_RETURN(m_endpoint->SetZlt(zlt));
}
}

View file

@ -26,12 +26,12 @@ namespace ams::usb {
} in = { size, address };
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatchInOut(std::addressof(m_srv), 0, in, *out_urb_id);
R_RETURN(serviceDispatchInOut(std::addressof(m_srv), 0, in, *out_urb_id));
}
Result RemoteDsEndpoint::Cancel() {
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatch(std::addressof(m_srv), 1);
R_RETURN(serviceDispatch(std::addressof(m_srv), 1));
}
Result RemoteDsEndpoint::GetCompletionEvent(sf::OutCopyHandle out) {
@ -49,19 +49,19 @@ namespace ams::usb {
Result RemoteDsEndpoint::GetUrbReport(sf::Out<usb::UrbReport> out) {
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatchOut(std::addressof(m_srv), 3, *out);
R_RETURN(serviceDispatchOut(std::addressof(m_srv), 3, *out));
}
Result RemoteDsEndpoint::Stall() {
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatch(std::addressof(m_srv), 4);
R_RETURN(serviceDispatch(std::addressof(m_srv), 4));
}
Result RemoteDsEndpoint::SetZlt(bool zlt) {
const u8 in = zlt ? 1 : 0;
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatchIn(std::addressof(m_srv), 5, in);
R_RETURN(serviceDispatchIn(std::addressof(m_srv), 5, in));
}
#endif

View file

@ -62,7 +62,7 @@ namespace ams::usb {
} in = { size, address };
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatchInOut(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 3 : 5, in, *out_urb_id);
R_RETURN(serviceDispatchInOut(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 3 : 5, in, *out_urb_id));
}
Result RemoteDsInterface::CtrlOutAsync(sf::Out<u32> out_urb_id, u64 address, u32 size) {
@ -72,7 +72,7 @@ namespace ams::usb {
} in = { size, address };
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatchInOut(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 4 : 6, in, *out_urb_id);
R_RETURN(serviceDispatchInOut(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 4 : 6, in, *out_urb_id));
}
Result RemoteDsInterface::GetCtrlInCompletionEvent(sf::OutCopyHandle out) {
@ -90,7 +90,7 @@ namespace ams::usb {
Result RemoteDsInterface::GetCtrlInUrbReport(sf::Out<usb::UrbReport> out) {
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatchOut(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 6 : 8, *out);
R_RETURN(serviceDispatchOut(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 6 : 8, *out));
}
Result RemoteDsInterface::GetCtrlOutCompletionEvent(sf::OutCopyHandle out) {
@ -108,12 +108,12 @@ namespace ams::usb {
Result RemoteDsInterface::GetCtrlOutUrbReport(sf::Out<usb::UrbReport> out) {
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatchOut(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 8 : 10, *out);
R_RETURN(serviceDispatchOut(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 8 : 10, *out));
}
Result RemoteDsInterface::CtrlStall() {
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 9 : 11);
R_RETURN(serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 9 : 11));
}
Result RemoteDsInterface::AppendConfigurationData(u8 bInterfaceNumber, usb::UsbDeviceSpeed device_speed, const sf::InBuffer &data) {
@ -141,14 +141,14 @@ namespace ams::usb {
R_SUCCEED_IF(hos::GetVersion() >= hos::Version_11_0_0);
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatch(std::addressof(m_srv), 3);
R_RETURN(serviceDispatch(std::addressof(m_srv), 3));
}
Result RemoteDsInterface::Disable() {
R_SUCCEED_IF(hos::GetVersion() >= hos::Version_11_0_0);
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatch(std::addressof(m_srv), 3);
R_RETURN(serviceDispatch(std::addressof(m_srv), 3));
}
#endif

View file

@ -70,12 +70,12 @@ namespace ams::usb {
Result RemoteDsService::GetState(sf::Out<usb::UsbState> out) {
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatchOut(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 3 : 4, *out);
R_RETURN(serviceDispatchOut(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 3 : 4, *out));
}
Result RemoteDsService::ClearDeviceData() {
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 4 : 5);
R_RETURN(serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 4 : 5));
}
Result RemoteDsService::AddUsbStringDescriptor(sf::Out<u8> out, const sf::InBuffer &desc) {
@ -88,7 +88,7 @@ namespace ams::usb {
Result RemoteDsService::DeleteUsbStringDescriptor(u8 index) {
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatchIn(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 6 : 7, index);
R_RETURN(serviceDispatchIn(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 6 : 7, index));
}
Result RemoteDsService::SetUsbDeviceDescriptor(const sf::InBuffer &desc, usb::UsbDeviceSpeed speed) {
@ -109,12 +109,12 @@ namespace ams::usb {
Result RemoteDsService::Enable() {
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 9 : 10);
R_RETURN(serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 9 : 10));
}
Result RemoteDsService::Disable() {
serviceAssumeDomain(std::addressof(m_srv));
return serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 10 : 11);
R_RETURN(serviceDispatch(std::addressof(m_srv), hos::GetVersion() >= hos::Version_11_0_0 ? 10 : 11));
}
#endif