ALSA: snd-usb: mixer: remove error messages on failed kmalloc()
If kmalloc() fails, warnings will be loud enough. We can safely just return -ENOMEM in such cases. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
6bc170e4e8
commit
a860d95f74
1 changed files with 3 additions and 12 deletions
|
@ -1229,10 +1229,8 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cval = kzalloc(sizeof(*cval), GFP_KERNEL);
|
cval = kzalloc(sizeof(*cval), GFP_KERNEL);
|
||||||
if (!cval) {
|
if (!cval)
|
||||||
usb_audio_err(state->chip, "cannot malloc kcontrol\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
cval->mixer = state->mixer;
|
cval->mixer = state->mixer;
|
||||||
cval->id = unitid;
|
cval->id = unitid;
|
||||||
cval->control = control;
|
cval->control = control;
|
||||||
|
@ -1815,10 +1813,8 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
|
||||||
if (check_ignored_ctl(map))
|
if (check_ignored_ctl(map))
|
||||||
continue;
|
continue;
|
||||||
cval = kzalloc(sizeof(*cval), GFP_KERNEL);
|
cval = kzalloc(sizeof(*cval), GFP_KERNEL);
|
||||||
if (!cval) {
|
if (!cval)
|
||||||
usb_audio_err(state->chip, "cannot malloc kcontrol\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
cval->mixer = state->mixer;
|
cval->mixer = state->mixer;
|
||||||
cval->id = unitid;
|
cval->id = unitid;
|
||||||
cval->control = valinfo->control;
|
cval->control = valinfo->control;
|
||||||
|
@ -1849,7 +1845,6 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
|
||||||
|
|
||||||
kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
|
kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
|
||||||
if (!kctl) {
|
if (!kctl) {
|
||||||
usb_audio_err(state->chip, "cannot malloc kcontrol\n");
|
|
||||||
kfree(cval);
|
kfree(cval);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
@ -2028,10 +2023,8 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cval = kzalloc(sizeof(*cval), GFP_KERNEL);
|
cval = kzalloc(sizeof(*cval), GFP_KERNEL);
|
||||||
if (!cval) {
|
if (!cval)
|
||||||
usb_audio_err(state->chip, "cannot malloc kcontrol\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
cval->mixer = state->mixer;
|
cval->mixer = state->mixer;
|
||||||
cval->id = unitid;
|
cval->id = unitid;
|
||||||
cval->val_type = USB_MIXER_U8;
|
cval->val_type = USB_MIXER_U8;
|
||||||
|
@ -2048,7 +2041,6 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
|
||||||
|
|
||||||
namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL);
|
namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL);
|
||||||
if (!namelist) {
|
if (!namelist) {
|
||||||
usb_audio_err(state->chip, "cannot malloc\n");
|
|
||||||
kfree(cval);
|
kfree(cval);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
@ -2058,7 +2050,6 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
|
||||||
len = 0;
|
len = 0;
|
||||||
namelist[i] = kmalloc(MAX_ITEM_NAME_LEN, GFP_KERNEL);
|
namelist[i] = kmalloc(MAX_ITEM_NAME_LEN, GFP_KERNEL);
|
||||||
if (!namelist[i]) {
|
if (!namelist[i]) {
|
||||||
usb_audio_err(state->chip, "cannot malloc\n");
|
|
||||||
while (i--)
|
while (i--)
|
||||||
kfree(namelist[i]);
|
kfree(namelist[i]);
|
||||||
kfree(namelist);
|
kfree(namelist);
|
||||||
|
|
Loading…
Add table
Reference in a new issue