Skip to content

Commit 74f5362

Browse files
tiwaifourkbomb
authored andcommitted
ALSA: usb-audio: Minor code cleanup in create_fixed_stream_quirk()
Just a minor code cleanup: unify the error paths. Change-Id: I31346b08ed1024819c58eff797c63bb42c283512 Signed-off-by: Takashi Iwai <[email protected]>
1 parent aa37926 commit 74f5362

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Diff for: sound/usb/quirks.c

+9-8
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,12 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
153153
stream = (fp->endpoint & USB_DIR_IN)
154154
? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
155155
err = snd_usb_add_audio_stream(chip, stream, fp);
156-
if (err < 0) {
157-
kfree(fp);
158-
kfree(rate_table);
159-
return err;
160-
}
156+
if (err < 0)
157+
goto error;
161158
if (fp->iface != get_iface_desc(&iface->altsetting[0])->bInterfaceNumber ||
162159
fp->altset_idx >= iface->num_altsetting) {
163-
kfree(fp);
164-
kfree(rate_table);
165-
return -EINVAL;
160+
err = -EINVAL;
161+
goto error;
166162
}
167163
alts = &iface->altsetting[fp->altset_idx];
168164
fp->datainterval = snd_usb_parse_datainterval(chip, alts);
@@ -171,6 +167,11 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
171167
snd_usb_init_pitch(chip, fp->iface, alts, fp);
172168
snd_usb_init_sample_rate(chip, fp->iface, alts, fp, fp->rate_max);
173169
return 0;
170+
171+
error:
172+
kfree(fp);
173+
kfree(rate_table);
174+
return err;
174175
}
175176

176177
/*

0 commit comments

Comments
 (0)