Commit d6d52179 authored by JS Park's avatar JS Park Committed by Mark Brown

ASoC: wm_adsp: Fix memory leak in wm_adsp_setup_algs

Signed-off-by: default avatarJS Park <aitdark.park@samsung.com>
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent cdcd7f72
...@@ -1053,8 +1053,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) ...@@ -1053,8 +1053,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
be32_to_cpu(adsp1_alg[i].zm)); be32_to_cpu(adsp1_alg[i].zm));
region = kzalloc(sizeof(*region), GFP_KERNEL); region = kzalloc(sizeof(*region), GFP_KERNEL);
if (!region) if (!region) {
return -ENOMEM; ret = -ENOMEM;
goto out;
}
region->type = WMFW_ADSP1_DM; region->type = WMFW_ADSP1_DM;
region->alg = be32_to_cpu(adsp1_alg[i].alg.id); region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
region->base = be32_to_cpu(adsp1_alg[i].dm); region->base = be32_to_cpu(adsp1_alg[i].dm);
...@@ -1071,8 +1073,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) ...@@ -1071,8 +1073,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
} }
region = kzalloc(sizeof(*region), GFP_KERNEL); region = kzalloc(sizeof(*region), GFP_KERNEL);
if (!region) if (!region) {
return -ENOMEM; ret = -ENOMEM;
goto out;
}
region->type = WMFW_ADSP1_ZM; region->type = WMFW_ADSP1_ZM;
region->alg = be32_to_cpu(adsp1_alg[i].alg.id); region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
region->base = be32_to_cpu(adsp1_alg[i].zm); region->base = be32_to_cpu(adsp1_alg[i].zm);
...@@ -1101,8 +1105,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) ...@@ -1101,8 +1105,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
be32_to_cpu(adsp2_alg[i].zm)); be32_to_cpu(adsp2_alg[i].zm));
region = kzalloc(sizeof(*region), GFP_KERNEL); region = kzalloc(sizeof(*region), GFP_KERNEL);
if (!region) if (!region) {
return -ENOMEM; ret = -ENOMEM;
goto out;
}
region->type = WMFW_ADSP2_XM; region->type = WMFW_ADSP2_XM;
region->alg = be32_to_cpu(adsp2_alg[i].alg.id); region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
region->base = be32_to_cpu(adsp2_alg[i].xm); region->base = be32_to_cpu(adsp2_alg[i].xm);
...@@ -1119,8 +1125,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) ...@@ -1119,8 +1125,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
} }
region = kzalloc(sizeof(*region), GFP_KERNEL); region = kzalloc(sizeof(*region), GFP_KERNEL);
if (!region) if (!region) {
return -ENOMEM; ret = -ENOMEM;
goto out;
}
region->type = WMFW_ADSP2_YM; region->type = WMFW_ADSP2_YM;
region->alg = be32_to_cpu(adsp2_alg[i].alg.id); region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
region->base = be32_to_cpu(adsp2_alg[i].ym); region->base = be32_to_cpu(adsp2_alg[i].ym);
...@@ -1137,8 +1145,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) ...@@ -1137,8 +1145,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp)
} }
region = kzalloc(sizeof(*region), GFP_KERNEL); region = kzalloc(sizeof(*region), GFP_KERNEL);
if (!region) if (!region) {
return -ENOMEM; ret = -ENOMEM;
goto out;
}
region->type = WMFW_ADSP2_ZM; region->type = WMFW_ADSP2_ZM;
region->alg = be32_to_cpu(adsp2_alg[i].alg.id); region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
region->base = be32_to_cpu(adsp2_alg[i].zm); region->base = be32_to_cpu(adsp2_alg[i].zm);
......
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