aoa_snd_device_new() returns -ENOMEM when aoa_get_card()
returns NULL.

This is misleading because the failure indicates that no ALSA
card is available, not that memory allocation failed.

Return -ENODEV instead to report the missing device correctly.

Signed-off-by: Sreeraj S Kurup <[email protected]>
---
 sound/aoa/core/alsa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/aoa/core/alsa.c b/sound/aoa/core/alsa.c
index aad7dfe089c7..bc7e576ab279 100644
--- a/sound/aoa/core/alsa.c
+++ b/sound/aoa/core/alsa.c
@@ -64,7 +64,8 @@ int aoa_snd_device_new(enum snd_device_type type,
        struct snd_card *card = aoa_get_card();
        int err;
 
-       if (!card) return -ENOMEM;
+       if (!card)
+               return -ENODEV;
 
        err = snd_device_new(card, type, device_data, ops);
        if (err) {
-- 
2.55.0


Reply via email to