Kernel/USB: Use TRY() and adopt_nonnull_own_or_enomem() some more

This commit is contained in:
Andreas Kling 2021-09-06 12:03:13 +02:00
parent e3b063581e
commit f173f73f10
Notes: sideshowbarker 2024-07-18 04:37:19 +09:00
4 changed files with 5 additions and 20 deletions

View file

@ -85,11 +85,7 @@ static USBHubDescriptor uhci_root_hub_hub_descriptor = {
KResultOr<NonnullOwnPtr<UHCIRootHub>> UHCIRootHub::try_create(NonnullRefPtr<UHCIController> uhci_controller)
{
auto root_hub = adopt_own_if_nonnull(new (nothrow) UHCIRootHub(uhci_controller));
if (!root_hub)
return ENOMEM;
return root_hub.release_nonnull();
return adopt_nonnull_own_or_enomem(new (nothrow) UHCIRootHub(uhci_controller));
}
UHCIRootHub::UHCIRootHub(NonnullRefPtr<UHCIController> uhci_controller)