public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: emu10k1: fix error codes
@ 2023-04-21 17:26 Oswald Buddenhagen
  2023-04-22  7:46 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Oswald Buddenhagen @ 2023-04-21 17:26 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai

One might argue that this potentially breaks user space, but a) this is
just one driver among many, so it seems unlikely that someone would
expect (only) the broken codes and b) it seems unlikely that someone
would check these syscalls for particular errors at all, rather than
just logging them (this might be debatable for the voice allocator
calls).

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
---
 sound/pci/emu10k1/emu10k1_callback.c | 2 +-
 sound/pci/emu10k1/emufx.c            | 4 ++--
 sound/pci/emu10k1/io.c               | 2 +-
 sound/pci/emu10k1/voice.c            | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c
index dba1e9fc2eec..5943747eb7db 100644
--- a/sound/pci/emu10k1/emu10k1_callback.c
+++ b/sound/pci/emu10k1/emu10k1_callback.c
@@ -106,7 +106,7 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw)
 	}
 
 	/* not found */
-	return -ENOMEM;
+	return -EBUSY;
 }
 
 
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 6cf7c8b1de47..267d1bab3ee4 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -360,15 +360,15 @@ static int snd_emu10k1_gpr_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl
 			break;
 		case EMU10K1_GPR_TRANSLATION_BASS:
 			if ((ctl->count % 5) != 0 || (ctl->count / 5) != ctl->vcount) {
-				change = -EIO;
+				change = -EINVAL;
 				goto __error;
 			}
 			for (j = 0; j < 5; j++)
 				snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, bass_table[val][j]);
 			break;
 		case EMU10K1_GPR_TRANSLATION_TREBLE:
 			if ((ctl->count % 5) != 0 || (ctl->count / 5) != ctl->vcount) {
-				change = -EIO;
+				change = -EINVAL;
 				goto __error;
 			}
 			for (j = 0; j < 5; j++)
diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c
index e15092ce9848..cfcdb33992bf 100644
--- a/sound/pci/emu10k1/io.c
+++ b/sound/pci/emu10k1/io.c
@@ -226,7 +226,7 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu,
 		dev_err(emu->card->dev, "status=0x%x, reg=%d, value=%d\n",
 			status, reg, value);
 		/* dump_stack(); */
-		err = -EINVAL;
+		err = -EIO;
 	}
     
 	spin_unlock(&emu->i2c_lock);
diff --git a/sound/pci/emu10k1/voice.c b/sound/pci/emu10k1/voice.c
index cbeb8443492c..a5cb932d525a 100644
--- a/sound/pci/emu10k1/voice.c
+++ b/sound/pci/emu10k1/voice.c
@@ -70,7 +70,7 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number,
 	}
 	
 	if (first_voice == last_voice)
-		return -ENOMEM;
+		return -EBUSY;
 	
 	for (i = 0; i < number; i++) {
 		voice = &emu->voices[(first_voice + i) % NUM_G];
-- 
2.40.0.152.g15d061e6df


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-22 15:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-21 17:26 [PATCH] ALSA: emu10k1: fix error codes Oswald Buddenhagen
2023-04-22  7:46 ` Takashi Iwai
2023-04-22 12:04   ` Oswald Buddenhagen
2023-04-22 15:31     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox