From patchwork Fri Apr 21 17:26:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oswald Buddenhagen X-Patchwork-Id: 13220482 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6FDF5C7618E for ; Fri, 21 Apr 2023 17:27:52 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9623BE97; Fri, 21 Apr 2023 19:26:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9623BE97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1682098069; bh=UwB9BerKKhClZk7IPYcgH9+cW+u3zI8f76SJeRAYsvA=; h=From:To:Subject:Date:CC:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=R2GqMyHCgOJYDCHgDD5jMC0qa0PLr019SpSSalAVX2qDHZE4ieervuAD1Z4kkgWPj VdqEIUDGetc3NUa41Tz2CM1Aqpg/Pq+qx9HrAaVPB52FSBFUljzAbHxdAFMxdAe02x bUtjQfg6CAgiQucdHoRg3JfYdcHPGea3IaZBGdB0= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E066EF80155; Fri, 21 Apr 2023 19:26:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 44303F8019B; Fri, 21 Apr 2023 19:26:30 +0200 (CEST) Received: from bluemchen.kde.org (bluemchen.kde.org [209.51.188.41]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3924DF80053 for ; Fri, 21 Apr 2023 19:26:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3924DF80053 Received: from ugly.fritz.box (localhost [127.0.0.1]) by bluemchen.kde.org (Postfix) with ESMTP id F2F82240DB; Fri, 21 Apr 2023 13:26:23 -0400 (EDT) Received: by ugly.fritz.box (masqmail 0.3.4, from userid 1000) id 1ppuWd-Gcx-00; Fri, 21 Apr 2023 19:26:23 +0200 From: Oswald Buddenhagen To: alsa-devel@alsa-project.org Subject: [PATCH] ALSA: emu10k1: fix error codes Date: Fri, 21 Apr 2023 19:26:23 +0200 Message-Id: <20230421172623.1017222-1-oswald.buddenhagen@gmx.de> X-Mailer: git-send-email 2.40.0.152.g15d061e6df MIME-Version: 1.0 Message-ID-Hash: BDPSGH2WTCW2DFVAELIAGYQXCOGXHGSR X-Message-ID-Hash: BDPSGH2WTCW2DFVAELIAGYQXCOGXHGSR X-MailFrom: ossi@kde.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Takashi Iwai X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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];