Skip to content

Commit

Permalink
ALSA: usb-audio: assume valid clock
Browse files Browse the repository at this point in the history
If the interface can't report a clock's validity, assume that it's
valid.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Vicente Joel <vicentejoel@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Daniel Mack authored and Takashi Iwai committed May 18, 2011
1 parent 0ef2832 commit 3bc6fbc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sound/usb/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
int err;
unsigned char data;
struct usb_device *dev = chip->dev;
struct uac_clock_source_descriptor *cs_desc =
snd_usb_find_clock_source(chip->ctrl_intf, source_id);

if (!cs_desc)
return 0;

/* If a clock source can't tell us whether it's valid, we assume it is */
if (!uac2_control_is_readable(cs_desc->bmControls, UAC2_CS_CONTROL_CLOCK_VALID))
return 1;

err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
Expand All @@ -114,7 +123,7 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
if (err < 0) {
snd_printk(KERN_WARNING "%s(): cannot get clock validity for id %d\n",
__func__, source_id);
return err;
return 0;
}

return !!data;
Expand Down

0 comments on commit 3bc6fbc

Please sign in to comment.