Skip to content

Commit 291e9da

Browse files
perexgtiwai
authored andcommitted
ALSA: usb-audio: Always initialize fixed_rate in snd_usb_find_implicit_fb_sync_format()
Handle the fallback code path, too. Fixes: fd28941 ("ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless") BugLink: https://lore.kernel.org/alsa-devel/Y7frf3N%2FxzvESEsN@kili/ Reported-by: Dan Carpenter <[email protected]> Cc: <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent ae50e2a commit 291e9da

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

sound/usb/implicit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ snd_usb_find_implicit_fb_sync_format(struct snd_usb_audio *chip,
471471
subs = find_matching_substream(chip, stream, target->sync_ep,
472472
target->fmt_type);
473473
if (!subs)
474-
return sync_fmt;
474+
goto end;
475475

476476
high_score = 0;
477477
list_for_each_entry(fp, &subs->fmt_list, list) {
@@ -485,6 +485,7 @@ snd_usb_find_implicit_fb_sync_format(struct snd_usb_audio *chip,
485485
}
486486
}
487487

488+
end:
488489
if (fixed_rate)
489490
*fixed_rate = snd_usb_pcm_has_fixed_rate(subs);
490491
return sync_fmt;

sound/usb/pcm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ bool snd_usb_pcm_has_fixed_rate(struct snd_usb_substream *subs)
163163
struct snd_usb_audio *chip = subs->stream->chip;
164164
int rate = -1;
165165

166+
if (!subs)
167+
return false;
166168
if (!(chip->quirk_flags & QUIRK_FLAG_FIXED_RATE))
167169
return false;
168170
list_for_each_entry(fp, &subs->fmt_list, list) {

0 commit comments

Comments
 (0)