From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794362040; b=wQvnI/1p83uzCBtKtHMncU3YIeu1rYnvc/Ik/kvHPNBbQb+syF/KVIcjJMKnfCZHOL7A HMFESGapHUbkupz9r8EvlZJ3oPoRR/PPWjPBi4pk4UQqNS1KMLLPjUKtkqm+vOxlRZskr iEQtbUchTJmUYCPcLdj2KoWy6SzQwTcLRh95umQ3wtNqLDh+KzJQbuKqyoaZxWbCtL2tD BW+RuS1Kpe9uHtSW98O6/a890gS6HoGBCTA5m6OabIWdNuWI/ChxhqCjlLUak22r6Rxx1 PEZ6iR4GJESI8SJaXAAVGKGOcs+OzdJSDqTiNeRKHY3mXDREwDzthXSXZN3pcKJvJBg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794362040; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=zmgzUgrJuBqE70uE/n5kXQPBymErGUYD99yuhdR4Mu8=; b=YO2aJmeeiAGEoAmOLT1EInVgBheOHIlBvt5/LygMM+9qZ2P/x+GE743QEuSrN5NsW76X PlokxWHJ/JC9cFZZt5KU0riMMvlnEYghiEm/A8ta4wOmK+PJ73TPZ5asWOzHYHlHhv+SD eEEDX1k9U0+R3Dmg/X8nR4E5zZ3vmcK2WWq0UOP8M+QQSOVW3utLlUMEzB8BiDsxzI323 qOndhcCCdrQAIeoE/LB5q5Xjxb10wxf/nwUgD3gBFh638g45/vKRs1F7tTTLlOaDegEzB j0KNS6ENYc2Et4KIM6bNkE0f+6v4dKxqviNHa+Z+VXSYbX/pt8qcXZ3J04w14ssq9fw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SlrjhjDu; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3046606A321 for ; Wed, 11 Nov 2026 01:54:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SlrjhjDu Received: by smtp.kernel.org (Postfix) with ESMTPSA id 263B01F0089F; Wed, 11 Nov 2026 01:54:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794362040; bh=zmgzUgrJuBqE70uE/n5kXQPBymErGUYD99yuhdR4Mu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SlrjhjDuHMjSypZGfHTjaGI59cAMxPYcv0DVyJwwZcl3ms1YMIZNhMClqJl2RqKG3 KhEB+grPkxOx5lPTJoVlSVYR7RUDPPbySQe0hRTpn6ENAVjaqTXo4nx0Rv3LYOiF02 je3sPqS6oXFGcQrlK9G35Ou3pi+sIwSgsHDaAJFQGRafwsOkx/+v+3W2Qmxs8B9UBT 1DCz9fKtdUGlsQYqD/4nX2vLvdBYicpIwAt1xKsQELhGgyZ507vPgLksLur6KlExC9 mHkr7AsBZAw5AdB/su/M/9IhiLZvHEeeKmsIQ/MRR4wLFsgQBLRWo/2zZvv3Lp4HyS L/d7TWyQv/Cpw== From: Sasha Levin To: stable@vger.kernel.org Cc: Oswald Buddenhagen , Takashi Iwai , Sasha Levin Subject: [PATCH 6.1.y 3/4] ALSA: emux: simplify snd_sf_list.callback handling Date: Tue, 10 Nov 2026 20:53:56 -0500 Message-ID: <20261111015344.441072-3-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261111015344.441072-1-sashal@kernel.org> References: <20261107055205-failed-6.1-8a5d87c2ba30@kernel.org> <20261111015344.441072-1-sashal@kernel.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Oswald Buddenhagen [ Upstream commit 4c4cbe66828f185903d2127aed6ac9b7302e9d3a ] Both drivers provide both sample_new and sample_free, and it makes no sense to pretend that they could not. In fact, load_data() would already crash if sample_new was null. So remove the remaining null checks. Contrary to that, the emu10k1 driver actually has a null sample_reset, though I'm not convinced that this inconsistency is justified. Signed-off-by: Oswald Buddenhagen Message-ID: <20240406064830.1029573-18-oswald.buddenhagen@gmx.de> Signed-off-by: Takashi Iwai Stable-dep-of: 8a5d87c2ba30 ("ALSA: emux: Stop voices before freeing zones in all cases") Signed-off-by: Sasha Levin --- sound/synth/emux/emux.c | 6 ++---- sound/synth/emux/soundfont.c | 12 +++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c index a870759d179ed..a02f952d74ba2 100644 --- a/sound/synth/emux/emux.c +++ b/sound/synth/emux/emux.c @@ -94,10 +94,8 @@ int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, ch /* create soundfont list */ memset(&sf_cb, 0, sizeof(sf_cb)); sf_cb.private_data = emu; - if (emu->ops.sample_new) - sf_cb.sample_new = sf_sample_new; - if (emu->ops.sample_free) - sf_cb.sample_free = sf_sample_free; + sf_cb.sample_new = sf_sample_new; + sf_cb.sample_free = sf_sample_free; if (emu->ops.sample_reset) sf_cb.sample_reset = sf_sample_reset; emu->sflist = snd_sf_new(&sf_cb, emu->memhdr); diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c index c8775c21bc6f2..c803c5c756114 100644 --- a/sound/synth/emux/soundfont.c +++ b/sound/synth/emux/soundfont.c @@ -1052,7 +1052,7 @@ load_guspatch(struct snd_sf_list *sflist, const char __user *data, /* * load wave data */ - if (smp->v.size > 0 && sflist->callback.sample_new) { + if (smp->v.size > 0) { rc = sflist->callback.sample_new (sflist->callback.private_data, smp, sflist->memhdr, data, count); @@ -1417,9 +1417,8 @@ snd_sf_clear(struct snd_sf_list *sflist) } for (sp = sf->samples; sp; sp = nextsp) { nextsp = sp->next; - if (sflist->callback.sample_free) - sflist->callback.sample_free(sflist->callback.private_data, - sp, sflist->memhdr); + sflist->callback.sample_free(sflist->callback.private_data, + sp, sflist->memhdr); kfree(sp); } kfree(sf); @@ -1521,9 +1520,8 @@ snd_soundfont_remove_unlocked(struct snd_sf_list *sflist) nextsp = sp->next; sf->samples = nextsp; sflist->mem_used -= sp->v.truesize; - if (sflist->callback.sample_free) - sflist->callback.sample_free(sflist->callback.private_data, - sp, sflist->memhdr); + sflist->callback.sample_free(sflist->callback.private_data, + sp, sflist->memhdr); kfree(sp); } } -- 2.53.0