mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
Kernel/Audio: Propagate errors when creating AudioChannels
While doing this, we can also just return a normal RefPtr instead of a LockRefPtr, because we create these channels when initializing an audio controller, and never change the pointer in AudioController instances after their initialization, hence no locking is necessary.
This commit is contained in:
parent
4921561687
commit
dd7633c5f4
8 changed files with 16 additions and 18 deletions
|
@ -13,12 +13,9 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
UNMAP_AFTER_INIT NonnullLockRefPtr<AudioChannel> AudioChannel::must_create(AudioController const& controller, size_t channel_index)
|
||||
UNMAP_AFTER_INIT ErrorOr<NonnullRefPtr<AudioChannel>> AudioChannel::create(AudioController const& controller, size_t channel_index)
|
||||
{
|
||||
auto audio_device_or_error = DeviceManagement::try_create_device<AudioChannel>(controller, channel_index);
|
||||
// FIXME: Find a way to propagate errors
|
||||
VERIFY(!audio_device_or_error.is_error());
|
||||
return audio_device_or_error.release_value();
|
||||
return *TRY(DeviceManagement::try_create_device<AudioChannel>(controller, channel_index));
|
||||
}
|
||||
|
||||
AudioChannel::AudioChannel(AudioController const& controller, size_t channel_index)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue