{
struct wm_coeff_ctl *ctl;
struct wmfw_ctl_work *ctl_work;
- char *name;
+ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
char *region_name;
int ret;
- name = kmalloc(SNDRV_CTL_ELEM_ID_NAME_MAXLEN, GFP_KERNEL);
- if (!name)
- return -ENOMEM;
-
switch (alg_region->type) {
case WMFW_ADSP1_PM:
region_name = "PM";
region_name = "ZM";
break;
default:
- ret = -EINVAL;
- goto err_name;
+ return -EINVAL;
}
snprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "DSP%d %s %x",
if (!strcmp(ctl->name, name)) {
if (!ctl->enabled)
ctl->enabled = 1;
- goto found;
+ return 0;
}
}
ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
- if (!ctl) {
- ret = -ENOMEM;
- goto err_name;
- }
+ if (!ctl)
+ return -ENOMEM;
ctl->alg_region = *alg_region;
ctl->name = kmemdup(name, strlen(name) + 1, GFP_KERNEL);
if (!ctl->name) {
INIT_WORK(&ctl_work->work, wm_adsp_ctl_work);
schedule_work(&ctl_work->work);
-found:
- kfree(name);
-
return 0;
err_ctl_cache:
kfree(ctl->name);
err_ctl:
kfree(ctl);
-err_name:
- kfree(name);
+
return ret;
}