Skip to contentSkip to conversation

ALSA: pcmtest: Honor the enable parameter

PATCH In review HyeongJun An 2 participants 2 messages Oct 27

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

PATCH 1/1 ALSA: pcmtest: Honor the enable parameter

The enable module parameter is declared and documented as "Enable pcmtest soundcard.", but nothing reads it. Loading the module with enable=0 still creates the card.

Return -ENODEV from mod_init() when enable is false, as the pcsp driver does.

Fixes 315a3d57c64c ("ALSA: Implement the new Virtual PCM Test Driver")

---
Prepared with Claude Code (Claude Opus 5.5). Tested on x86_64: enable=0 now fails with -ENODEV and creates no card, and the pcmtest selftest still passes.

 sound/drivers/pcmtest.c | 3 +++
 1 file changed, 3 insertions(+)
sound/drivers/pcmtest.c +3 -0
index 422fdb10f237..66bee8a2ce34 100644
@@ -712,6 +712,9 @@ static int __init mod_init(void)
 {
 	int err = 0;
 
+	if (!enable)
+		return -ENODEV;
+
 	buf_allocated = setup_patt_bufs();
 	if (!buf_allocated)
 		return -ENOMEM;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 10 lines · HyeongJun An

The enable module parameter is declared and documented as "Enable pcmtest soundcard.", but nothing reads it. Loading the module with enable=0 still creates the card.

Return -ENODEV from mod_init() when enable is false, as the pcsp driver does.

Fixes 315a3d57c64c ("ALSA: Implement the new Virtual PCM Test Driver")

Applied now. Thanks.

Takashi