mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
Kernel/USB: Tidy up USB::Transfer construction
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user