Skip to contentSkip to conversation

ALSA: aoa: Return ENODEV when no sound card is available

PATCH Applied Sreeraj S Kurup 2 participants 3 messages Nov 30 – Dec 1

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: aoa: Return ENODEV when no sound card is available

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.

---
 sound/aoa/core/alsa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/aoa/core/alsa.c +2 -1
index aad7dfe089c7..bc7e576ab279 100644
@@ -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) {
Signature · 1 line
2.55.0
Applied
#1 lore raw
Quoted 10 lines · Sreeraj S Kurup

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.

Applied to for-next branch. Thanks.

Takashi