mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
Kernel/USB: Tidy up USB::Transfer construction
This commit is contained in:
parent
f4a9a0d561
commit
79fbad6df9
3 changed files with 5 additions and 9 deletions
|
@ -9,15 +9,15 @@
|
|||
|
||||
namespace Kernel::USB {
|
||||
|
||||
RefPtr<Transfer> Transfer::try_create(Pipe& pipe, u16 len)
|
||||
KResultOr<NonnullRefPtr<Transfer>> Transfer::try_create(Pipe& pipe, u16 len)
|
||||
{
|
||||
// Initialize data buffer for transfer
|
||||
// This will definitely need to be refactored in the future, I doubt this will scale well...
|
||||
auto data_buffer = MM.allocate_kernel_region(PAGE_SIZE, "USB Transfer Buffer", Memory::Region::Access::ReadWrite);
|
||||
if (!data_buffer)
|
||||
return {};
|
||||
return ENOMEM;
|
||||
|
||||
return try_make_ref_counted<Transfer>(pipe, len, data_buffer.release_nonnull());
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) Transfer(pipe, len, data_buffer.release_nonnull()));
|
||||
}
|
||||
|
||||
Transfer::Transfer(Pipe& pipe, u16 len, NonnullOwnPtr<Memory::Region> data_buffer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue