Skip to content

Commit 23b53d4

Browse files
committed
ALSA: pcm: One more dependency for hw constraints
The fix for a long-standing USB-audio bug required one more dependency variable to be added to the hw constraints. Unfortunately I didn't realize at debugging that the new addition may result in the overflow of the dependency array of each snd_pcm_hw_rule (up to three plus a sentinel), because USB-audio driver adds one more dependency only for a certain device and bus, hence it works as is for many devices. But in a bad case, a simple open always results in -EINVAL (with kernel WARNING if CONFIG_SND_DEBUG is set) no matter what is passed. Since the dependencies are real and unavoidable (USB-audio restricts the hw_params per looping over the format/rate/channels combos), the only good solution seems to raise the bar for one more dependency for snd_pcm_hw_rule -- so does this patch: now the hw constraint dependencies can be up to four. Fixes: 506c203 ("ALSA: usb-audio: Fix hw constraints dependencies") Reported-by: Jamie Heilman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 5de3b94 commit 23b53d4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/sound/pcm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ typedef int (*snd_pcm_hw_rule_func_t)(struct snd_pcm_hw_params *params,
229229
struct snd_pcm_hw_rule {
230230
unsigned int cond;
231231
int var;
232-
int deps[4];
232+
int deps[5];
233233

234234
snd_pcm_hw_rule_func_t func;
235235
void *private;

sound/core/pcm_native.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
382382
continue;
383383

384384
/*
385-
* The 'deps' array includes maximum three dependencies
386-
* to SNDRV_PCM_HW_PARAM_XXXs for this rule. The fourth
385+
* The 'deps' array includes maximum four dependencies
386+
* to SNDRV_PCM_HW_PARAM_XXXs for this rule. The fifth
387387
* member of this array is a sentinel and should be
388388
* negative value.
389389
*

0 commit comments

Comments
 (0)