mirror of
https://github.com/cathery/sys-con.git
synced 2024-11-16 14:09:51 +00:00
Fix up controller cleanup order
This commit is contained in:
parent
979f847b25
commit
a00188868c
@ -13,7 +13,6 @@ SwitchControllerHandler::SwitchControllerHandler(std::unique_ptr<IController> &&
|
||||
|
||||
SwitchControllerHandler::~SwitchControllerHandler()
|
||||
{
|
||||
Exit();
|
||||
}
|
||||
|
||||
Result SwitchControllerHandler::Initialize()
|
||||
|
@ -11,6 +11,11 @@ SwitchUSBEndpoint::SwitchUSBEndpoint(UsbHsClientIfSession &if_session, usb_endpo
|
||||
SwitchUSBEndpoint::~SwitchUSBEndpoint()
|
||||
{
|
||||
Close();
|
||||
if (m_buffer != nullptr)
|
||||
{
|
||||
free(m_buffer);
|
||||
m_buffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Result SwitchUSBEndpoint::Open(int maxPacketSize)
|
||||
@ -21,6 +26,8 @@ Result SwitchUSBEndpoint::Open(int maxPacketSize)
|
||||
if (R_FAILED(rc))
|
||||
return 73011;
|
||||
|
||||
if (m_buffer != nullptr)
|
||||
free(m_buffer);
|
||||
m_buffer = memalign(0x1000, maxPacketSize);
|
||||
if (m_buffer == nullptr)
|
||||
return -1;
|
||||
@ -29,12 +36,6 @@ Result SwitchUSBEndpoint::Open(int maxPacketSize)
|
||||
|
||||
void SwitchUSBEndpoint::Close()
|
||||
{
|
||||
if (m_buffer != nullptr)
|
||||
{
|
||||
free(m_buffer);
|
||||
m_buffer = nullptr;
|
||||
}
|
||||
|
||||
usbHsEpClose(&m_epSession);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user