提交 f34d0650 编写于 作者: E Eldad Zack 提交者: Takashi Iwai

ALSA: usb-audio: reverse condition logic in set_sync_endpoint

Reverse logic on the conditions required to qualify for a sync endpoint
and remove one level of indendation.
Signed-off-by: NEldad Zack <eldad@fogrefinery.com>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 a60945fd
...@@ -419,9 +419,13 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, ...@@ -419,9 +419,13 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
if (err < 0) if (err < 0)
return err; return err;
if (((is_playback && attr == USB_ENDPOINT_SYNC_ASYNC) || if (altsd->bNumEndpoints < 2)
(!is_playback && attr == USB_ENDPOINT_SYNC_ADAPTIVE)) && return 0;
altsd->bNumEndpoints >= 2) {
if ((is_playback && attr != USB_ENDPOINT_SYNC_ASYNC) ||
(!is_playback && attr != USB_ENDPOINT_SYNC_ADAPTIVE))
return 0;
/* check sync-pipe endpoint */ /* check sync-pipe endpoint */
/* ... and check descriptor size before accessing bSynchAddress /* ... and check descriptor size before accessing bSynchAddress
because there is a version of the SB Audigy 2 NX firmware lacking because there is a version of the SB Audigy 2 NX firmware lacking
...@@ -440,7 +444,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, ...@@ -440,7 +444,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
ep = get_endpoint(alts, 1)->bEndpointAddress; ep = get_endpoint(alts, 1)->bEndpointAddress;
if (!implicit_fb && if (!implicit_fb &&
get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
(( is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) || ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) ||
(!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) { (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) {
snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n", snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n",
dev->devnum, fmt->iface, fmt->altsetting, dev->devnum, fmt->iface, fmt->altsetting,
...@@ -460,7 +464,6 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, ...@@ -460,7 +464,6 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
return -EINVAL; return -EINVAL;
subs->data_endpoint->sync_master = subs->sync_endpoint; subs->data_endpoint->sync_master = subs->sync_endpoint;
}
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册