Commit f25ecf8f authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usb-audio: Follow standard coding style

Avoid if ((err = ...) style and expand to multiple lines instead.
No change in the end result, but just the beautification.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent e92be814
...@@ -508,7 +508,8 @@ static int snd_usb_audio_create(struct usb_interface *intf, ...@@ -508,7 +508,8 @@ static int snd_usb_audio_create(struct usb_interface *intf,
INIT_LIST_HEAD(&chip->midi_list); INIT_LIST_HEAD(&chip->midi_list);
INIT_LIST_HEAD(&chip->mixer_list); INIT_LIST_HEAD(&chip->mixer_list);
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
if (err < 0) {
snd_usb_audio_free(chip); snd_usb_audio_free(chip);
snd_card_free(card); snd_card_free(card);
return err; return err;
......
...@@ -443,10 +443,11 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface, ...@@ -443,10 +443,11 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
data[0] = rate; data[0] = rate;
data[1] = rate >> 8; data[1] = rate >> 8;
data[2] = rate >> 16; data[2] = rate >> 16;
if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
data, sizeof(data))) < 0) { data, sizeof(data));
if (err < 0) {
dev_err(&dev->dev, "%d:%d: cannot set freq %d to ep %#x\n", dev_err(&dev->dev, "%d:%d: cannot set freq %d to ep %#x\n",
iface, fmt->altsetting, rate, ep); iface, fmt->altsetting, rate, ep);
return err; return err;
...@@ -460,10 +461,11 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface, ...@@ -460,10 +461,11 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
if (chip->sample_rate_read_error > 2) if (chip->sample_rate_read_error > 2)
return 0; return 0;
if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC_GET_CUR, err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC_GET_CUR,
USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN, USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN,
UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep,
data, sizeof(data))) < 0) { data, sizeof(data));
if (err < 0) {
dev_err(&dev->dev, "%d:%d: cannot get freq at ep %#x\n", dev_err(&dev->dev, "%d:%d: cannot get freq at ep %#x\n",
iface, fmt->altsetting, ep); iface, fmt->altsetting, ep);
chip->sample_rate_read_error++; chip->sample_rate_read_error++;
......
...@@ -598,7 +598,8 @@ int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list, ...@@ -598,7 +598,8 @@ int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
while (snd_ctl_find_id(mixer->chip->card, &kctl->id)) while (snd_ctl_find_id(mixer->chip->card, &kctl->id))
kctl->id.index++; kctl->id.index++;
if ((err = snd_ctl_add(mixer->chip->card, kctl)) < 0) { err = snd_ctl_add(mixer->chip->card, kctl);
if (err < 0) {
usb_audio_dbg(mixer->chip, "cannot add control (err = %d)\n", usb_audio_dbg(mixer->chip, "cannot add control (err = %d)\n",
err); err);
return err; return err;
...@@ -1850,7 +1851,8 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, ...@@ -1850,7 +1851,8 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid,
} }
/* parse the source unit */ /* parse the source unit */
if ((err = parse_audio_unit(state, hdr->bSourceID)) < 0) err = parse_audio_unit(state, hdr->bSourceID);
if (err < 0)
return err; return err;
/* determine the input source type and name */ /* determine the input source type and name */
...@@ -2270,7 +2272,8 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, ...@@ -2270,7 +2272,8 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
} }
for (i = 0; i < num_ins; i++) { for (i = 0; i < num_ins; i++) {
if ((err = parse_audio_unit(state, desc->baSourceID[i])) < 0) err = parse_audio_unit(state, desc->baSourceID[i]);
if (err < 0)
return err; return err;
} }
...@@ -2483,7 +2486,8 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, ...@@ -2483,7 +2486,8 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
} }
for (i = 0; i < desc->bNrInPins; i++) { for (i = 0; i < desc->bNrInPins; i++) {
if ((err = parse_audio_unit(state, desc->baSourceID[i])) < 0) err = parse_audio_unit(state, desc->baSourceID[i]);
if (err < 0)
return err; return err;
} }
...@@ -3310,11 +3314,16 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, ...@@ -3310,11 +3314,16 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
if (mixer->protocol == UAC_VERSION_3 && if (mixer->protocol == UAC_VERSION_3 &&
chip->badd_profile >= UAC3_FUNCTION_SUBCLASS_GENERIC_IO) { chip->badd_profile >= UAC3_FUNCTION_SUBCLASS_GENERIC_IO) {
if ((err = snd_usb_mixer_controls_badd(mixer, ctrlif)) < 0) err = snd_usb_mixer_controls_badd(mixer, ctrlif);
if (err < 0)
goto _error;
} else {
err = snd_usb_mixer_controls(mixer);
if (err < 0)
goto _error;
err = snd_usb_mixer_status_create(mixer);
if (err < 0)
goto _error; goto _error;
} else if ((err = snd_usb_mixer_controls(mixer)) < 0 ||
(err = snd_usb_mixer_status_create(mixer)) < 0) {
goto _error;
} }
err = create_keep_iface_ctl(mixer); err = create_keep_iface_ctl(mixer);
if (err < 0) if (err < 0)
......
...@@ -1824,7 +1824,8 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) ...@@ -1824,7 +1824,8 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
int err = 0; int err = 0;
struct snd_info_entry *entry; struct snd_info_entry *entry;
if ((err = snd_usb_soundblaster_remote_init(mixer)) < 0) err = snd_usb_soundblaster_remote_init(mixer);
if (err < 0)
return err; return err;
switch (mixer->chip->usb_id) { switch (mixer->chip->usb_id) {
......
...@@ -163,10 +163,11 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface, ...@@ -163,10 +163,11 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface,
ep = get_endpoint(alts, 0)->bEndpointAddress; ep = get_endpoint(alts, 0)->bEndpointAddress;
data[0] = 1; data[0] = 1;
if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT,
UAC_EP_CS_ATTR_PITCH_CONTROL << 8, ep, UAC_EP_CS_ATTR_PITCH_CONTROL << 8, ep,
data, sizeof(data))) < 0) { data, sizeof(data));
if (err < 0) {
usb_audio_err(chip, "%d:%d: cannot set enable PITCH\n", usb_audio_err(chip, "%d:%d: cannot set enable PITCH\n",
iface, ep); iface, ep);
return err; return err;
...@@ -184,10 +185,11 @@ static int init_pitch_v2(struct snd_usb_audio *chip, int iface, ...@@ -184,10 +185,11 @@ static int init_pitch_v2(struct snd_usb_audio *chip, int iface,
int err; int err;
data[0] = 1; data[0] = 1;
if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR, err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR,
USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
UAC2_EP_CS_PITCH << 8, 0, UAC2_EP_CS_PITCH << 8, 0,
data, sizeof(data))) < 0) { data, sizeof(data));
if (err < 0) {
usb_audio_err(chip, "%d:%d: cannot set enable PITCH (v2)\n", usb_audio_err(chip, "%d:%d: cannot set enable PITCH (v2)\n",
iface, fmt->altsetting); iface, fmt->altsetting);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment