[PATCH] ALSA: pcmtest: Honor the enable parameter

From: HyeongJun An

Date: Mon Oct 26 2026 - 21:22:46 EST


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")
Signed-off-by: HyeongJun An <sammiee5311@xxxxxxxxx>
---
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(+)

diff --git a/sound/drivers/pcmtest.c b/sound/drivers/pcmtest.c
index 422fdb10f237..66bee8a2ce34 100644
--- a/sound/drivers/pcmtest.c
+++ b/sound/drivers/pcmtest.c
@@ -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;
--
2.43.0