diff options
author | JS Park <aitdark.park@samsung.com> | 2014-11-18 11:07:22 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-11-18 11:21:15 -0500 |
commit | d6d521799fac14e14dead4e9428158340ff6b95f (patch) | |
tree | 719d612e2322d250124ad22dd32b52b0914855f0 /sound/soc/codecs/wm_adsp.c | |
parent | cdcd7f7287532131d2075dd45f15aaf39dcfe983 (diff) |
ASoC: wm_adsp: Fix memory leak in wm_adsp_setup_algs
Signed-off-by: JS Park <aitdark.park@samsung.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/wm_adsp.c')
-rw-r--r-- | sound/soc/codecs/wm_adsp.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 0a08ef5e27c8..6a2a03570977 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
@@ -1053,8 +1053,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1053 | be32_to_cpu(adsp1_alg[i].zm)); | 1053 | be32_to_cpu(adsp1_alg[i].zm)); |
1054 | 1054 | ||
1055 | region = kzalloc(sizeof(*region), GFP_KERNEL); | 1055 | region = kzalloc(sizeof(*region), GFP_KERNEL); |
1056 | if (!region) | 1056 | if (!region) { |
1057 | return -ENOMEM; | 1057 | ret = -ENOMEM; |
1058 | goto out; | ||
1059 | } | ||
1058 | region->type = WMFW_ADSP1_DM; | 1060 | region->type = WMFW_ADSP1_DM; |
1059 | region->alg = be32_to_cpu(adsp1_alg[i].alg.id); | 1061 | region->alg = be32_to_cpu(adsp1_alg[i].alg.id); |
1060 | region->base = be32_to_cpu(adsp1_alg[i].dm); | 1062 | region->base = be32_to_cpu(adsp1_alg[i].dm); |
@@ -1071,8 +1073,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1071 | } | 1073 | } |
1072 | 1074 | ||
1073 | region = kzalloc(sizeof(*region), GFP_KERNEL); | 1075 | region = kzalloc(sizeof(*region), GFP_KERNEL); |
1074 | if (!region) | 1076 | if (!region) { |
1075 | return -ENOMEM; | 1077 | ret = -ENOMEM; |
1078 | goto out; | ||
1079 | } | ||
1076 | region->type = WMFW_ADSP1_ZM; | 1080 | region->type = WMFW_ADSP1_ZM; |
1077 | region->alg = be32_to_cpu(adsp1_alg[i].alg.id); | 1081 | region->alg = be32_to_cpu(adsp1_alg[i].alg.id); |
1078 | region->base = be32_to_cpu(adsp1_alg[i].zm); | 1082 | region->base = be32_to_cpu(adsp1_alg[i].zm); |
@@ -1101,8 +1105,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1101 | be32_to_cpu(adsp2_alg[i].zm)); | 1105 | be32_to_cpu(adsp2_alg[i].zm)); |
1102 | 1106 | ||
1103 | region = kzalloc(sizeof(*region), GFP_KERNEL); | 1107 | region = kzalloc(sizeof(*region), GFP_KERNEL); |
1104 | if (!region) | 1108 | if (!region) { |
1105 | return -ENOMEM; | 1109 | ret = -ENOMEM; |
1110 | goto out; | ||
1111 | } | ||
1106 | region->type = WMFW_ADSP2_XM; | 1112 | region->type = WMFW_ADSP2_XM; |
1107 | region->alg = be32_to_cpu(adsp2_alg[i].alg.id); | 1113 | region->alg = be32_to_cpu(adsp2_alg[i].alg.id); |
1108 | region->base = be32_to_cpu(adsp2_alg[i].xm); | 1114 | region->base = be32_to_cpu(adsp2_alg[i].xm); |
@@ -1119,8 +1125,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1119 | } | 1125 | } |
1120 | 1126 | ||
1121 | region = kzalloc(sizeof(*region), GFP_KERNEL); | 1127 | region = kzalloc(sizeof(*region), GFP_KERNEL); |
1122 | if (!region) | 1128 | if (!region) { |
1123 | return -ENOMEM; | 1129 | ret = -ENOMEM; |
1130 | goto out; | ||
1131 | } | ||
1124 | region->type = WMFW_ADSP2_YM; | 1132 | region->type = WMFW_ADSP2_YM; |
1125 | region->alg = be32_to_cpu(adsp2_alg[i].alg.id); | 1133 | region->alg = be32_to_cpu(adsp2_alg[i].alg.id); |
1126 | region->base = be32_to_cpu(adsp2_alg[i].ym); | 1134 | region->base = be32_to_cpu(adsp2_alg[i].ym); |
@@ -1137,8 +1145,10 @@ static int wm_adsp_setup_algs(struct wm_adsp *dsp) | |||
1137 | } | 1145 | } |
1138 | 1146 | ||
1139 | region = kzalloc(sizeof(*region), GFP_KERNEL); | 1147 | region = kzalloc(sizeof(*region), GFP_KERNEL); |
1140 | if (!region) | 1148 | if (!region) { |
1141 | return -ENOMEM; | 1149 | ret = -ENOMEM; |
1150 | goto out; | ||
1151 | } | ||
1142 | region->type = WMFW_ADSP2_ZM; | 1152 | region->type = WMFW_ADSP2_ZM; |
1143 | region->alg = be32_to_cpu(adsp2_alg[i].alg.id); | 1153 | region->alg = be32_to_cpu(adsp2_alg[i].alg.id); |
1144 | region->base = be32_to_cpu(adsp2_alg[i].zm); | 1154 | region->base = be32_to_cpu(adsp2_alg[i].zm); |