mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: aw2-alsa: select SND_PCM
@ 2026-11-13  6:46 Jude Gyimah
  2026-11-13  7:57 ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Jude Gyimah @ 2026-11-13  6:46 UTC (permalink / raw)
  To: perex, tiwai; +Cc: linux-sound, linux-kernel, Jude Gyimah

Several stanzas in sound/pci/Kconfig select SND_PCM.
SND_AW2 selects nothing at all.

aw2-alsa calls snd_pcm_new, which sound/core/pcm.c provides under SND_PCM.

  aw2-alsa.c:(.text+0x554): undefined reference to `snd_pcm_new'

4 symbols are undefined in all.

The driver can be built into vmlinux while SND_PCM is a module, in which
case the symbols are not there at link time.

Select rather than depend on: SND_PCM has no prompt of its own and is only
ever enabled by a select, so a depends on would leave SND_AW2
unselectable.

Reproduced on v7.3, arm64, with CONFIG_SND_AW2=y and CONFIG_SND_PCM=m.

Found with kreach, a static check that compares what Kconfig allows
against the symbols the compiled objects actually reference.

Fixes: 98f2a97f207a ("[ALSA] Emagic Audiowerk 2 ALSA driver.")
Signed-off-by: Jude Gyimah <jude.gyimah87@gmail.com>
---
 sound/pci/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 6366f72b3667..9c192d51ff44 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -141,6 +141,7 @@ config SND_AU8830
 
 config SND_AW2
 	tristate "Emagic Audiowerk 2"
+	select SND_PCM
 	help
 	  Say Y here to include support for Emagic Audiowerk 2 soundcards.
 
-- 
2.43.0


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

* Re: [PATCH] ALSA: aw2-alsa: select SND_PCM
  2026-11-13  6:46 [PATCH] ALSA: aw2-alsa: select SND_PCM Jude Gyimah
@ 2026-11-13  7:57 ` Takashi Iwai
  2026-11-13  8:59   ` Jude Gyimah
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2026-11-13  7:57 UTC (permalink / raw)
  To: Jude Gyimah; +Cc: perex, tiwai, linux-sound, linux-kernel

On Fri, 13 Nov 2026 07:46:14 +0100,
Jude Gyimah wrote:
> 
> Several stanzas in sound/pci/Kconfig select SND_PCM.
> SND_AW2 selects nothing at all.
> 
> aw2-alsa calls snd_pcm_new, which sound/core/pcm.c provides under SND_PCM.
> 
>   aw2-alsa.c:(.text+0x554): undefined reference to `snd_pcm_new'
> 
> 4 symbols are undefined in all.
> 
> The driver can be built into vmlinux while SND_PCM is a module, in which
> case the symbols are not there at link time.
> 
> Select rather than depend on: SND_PCM has no prompt of its own and is only
> ever enabled by a select, so a depends on would leave SND_AW2
> unselectable.
> 
> Reproduced on v7.3, arm64, with CONFIG_SND_AW2=y and CONFIG_SND_PCM=m.
> 
> Found with kreach, a static check that compares what Kconfig allows
> against the symbols the compiled objects actually reference.
> 
> Fixes: 98f2a97f207a ("[ALSA] Emagic Audiowerk 2 ALSA driver.")
> Signed-off-by: Jude Gyimah <jude.gyimah87@gmail.com>

Applied now.  It's interesting why this wasn't caught by build tests
for long time...


thanks,

Takashi

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

* Re: [PATCH] ALSA: aw2-alsa: select SND_PCM
  2026-11-13  7:57 ` Takashi Iwai
@ 2026-11-13  8:59   ` Jude Gyimah
  0 siblings, 0 replies; 3+ messages in thread
From: Jude Gyimah @ 2026-11-13  8:59 UTC (permalink / raw)
  To: tiwai; +Cc: perex, linux-sound, linux-kernel

> Applied now.  It's interesting why this wasn't caught by build tests
> for long time...

Thanks for applying it.

Yes i agree. Quite interesting that this flew under the radar.
The short answer is that none of the stock configurations can express
the combination, and each one misses it for a different reason.  On
arm64 at v7.3:

  defconfig       SND_AW2 not set     SND_PCM=m   caller absent
  allmodconfig    SND_AW2=m           SND_PCM=m   caller is a module too
  allyesconfig    SND_AW2=y           SND_PCM=y   provider built in
  allnoconfig     neither set

The failure needs SND_AW2=y while SND_PCM=m, and allmodconfig and
allyesconfig are each wrong in exactly one coordinate.

randconfig can express it but is unlikely to find it. And the reason is
kinda counter-intuitive i.e., 110 stanzas in 44 Kconfig files select SND_PCM.  
Any one of them at =y pins SND_PCM=y and hides every caller that does not
select it.  So the configuration has to put all 110 at m or n and this
driver at y.  Treating the tristates as independent and uniform (which
randconfig and tristates are not, since most sit behind PCI or a
platform) that is on the order of (2/3)^110.  The real figure will be
different, but the shape is right. The more drivers select a provider,
the better hidden the one driver that forgot to.

So SND_PCM being selected by almost everything is what protected this
bug rather than what would have exposed it. A sampler would have to be 
lucky in 110 places at once. Solving for the assignment instead takes 
it in one step, which is what turned this up.

It is not a one-off. The same y/m shape found 14 missing selects in
sound/, all of them now applied i.e., five Rockchip, three fsl, sunxi,
four Amlogic, and this. Reproducer configurations and the failing
vmlinux link log for each are published at
https://github.com/JGyimah/kreach under results/, if the ALSA side is
ever interested in running it over sound/ before a merge window.

Best,
Jude

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

end of thread, other threads:[~2026-11-13  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-13  6:46 [PATCH] ALSA: aw2-alsa: select SND_PCM Jude Gyimah
2026-11-13  7:57 ` Takashi Iwai
2026-11-13  8:59   ` Jude Gyimah

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

all inboxes | Powered by JetHome®