diff options
author | Ivan Orlov <ivan.orlov0322@gmail.com> | 2023-07-13 10:59:52 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2023-07-14 09:07:34 +0300 |
commit | 678a0bbe158076805843f6a58aa09b365fc43871 (patch) | |
tree | 5f1f6447ce8389d4c484b93682fed6a7593eebc1 /sound | |
parent | 67192cc0f0263847ab3ccdcfe90989624a0c7fe3 (diff) | |
download | linux-678a0bbe158076805843f6a58aa09b365fc43871.tar.xz |
ALSA: pcmtest: Add 'open' PCM callback error injection
Extend 'pcmtest' virtual driver with 'open' callback error injection
functionality, as it already can inject errors into other PCM callbacks.
Add module parameter which enables EBUSY error injection in the 'open'
PCM callback.
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230713075953.13692-1-ivan.orlov0322@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/drivers/pcmtest.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/drivers/pcmtest.c b/sound/drivers/pcmtest.c index 291e7fe47893..e74c523e49eb 100644 --- a/sound/drivers/pcmtest.c +++ b/sound/drivers/pcmtest.c @@ -65,6 +65,7 @@ static int inject_delay; static bool inject_hwpars_err; static bool inject_prepare_err; static bool inject_trigger_err; +static bool inject_open_err; static short fill_mode = FILL_MODE_PAT; @@ -88,6 +89,9 @@ module_param(inject_prepare_err, bool, 0600); MODULE_PARM_DESC(inject_prepare_err, "Inject EINVAL error in the 'prepare' callback"); module_param(inject_trigger_err, bool, 0600); MODULE_PARM_DESC(inject_trigger_err, "Inject EINVAL error in the 'trigger' callback"); +module_param(inject_open_err, bool, 0600); +MODULE_PARM_DESC(inject_open_err, "Inject EBUSY error in the 'open' callback"); + struct pcmtst { struct snd_pcm *pcm; @@ -364,6 +368,9 @@ static int snd_pcmtst_pcm_open(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; struct pcmtst_buf_iter *v_iter; + if (inject_open_err) + return -EBUSY; + v_iter = kzalloc(sizeof(*v_iter), GFP_KERNEL); if (!v_iter) return -ENOMEM; |