imx-audmix.c (0ea8a56de21be24cb79abb03dee79aabcd60a316) imx-audmix.c (f95cc5c18c15a425c3dceec48df6b4e27a202dda)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2017 NXP
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *

--- 171 unchanged lines hidden (view full) ---

180 return -EINVAL;
181 }
182
183 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
184 if (!priv)
185 return -ENOMEM;
186
187 priv->num_dai = 2 * num_dai;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2017 NXP
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *

--- 171 unchanged lines hidden (view full) ---

180 return -EINVAL;
181 }
182
183 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
184 if (!priv)
185 return -ENOMEM;
186
187 priv->num_dai = 2 * num_dai;
188 priv->dai = devm_kzalloc(&pdev->dev, priv->num_dai *
188 priv->dai = devm_kcalloc(&pdev->dev, priv->num_dai,
189 sizeof(struct snd_soc_dai_link), GFP_KERNEL);
190 if (!priv->dai)
191 return -ENOMEM;
192
193 priv->num_dai_conf = num_dai;
189 sizeof(struct snd_soc_dai_link), GFP_KERNEL);
190 if (!priv->dai)
191 return -ENOMEM;
192
193 priv->num_dai_conf = num_dai;
194 priv->dai_conf = devm_kzalloc(&pdev->dev, priv->num_dai_conf *
194 priv->dai_conf = devm_kcalloc(&pdev->dev, priv->num_dai_conf,
195 sizeof(struct snd_soc_codec_conf),
196 GFP_KERNEL);
197 if (!priv->dai_conf)
198 return -ENOMEM;
199
200 priv->num_dapm_routes = 3 * num_dai;
195 sizeof(struct snd_soc_codec_conf),
196 GFP_KERNEL);
197 if (!priv->dai_conf)
198 return -ENOMEM;
199
200 priv->num_dapm_routes = 3 * num_dai;
201 priv->dapm_routes = devm_kzalloc(&pdev->dev, priv->num_dapm_routes *
201 priv->dapm_routes = devm_kcalloc(&pdev->dev, priv->num_dapm_routes,
202 sizeof(struct snd_soc_dapm_route),
203 GFP_KERNEL);
204 if (!priv->dapm_routes)
205 return -ENOMEM;
206
207 for (i = 0; i < num_dai; i++) {
208 struct snd_soc_dai_link_component *dlc;
209
210 /* for CPU/Codec/Platform x 2 */
202 sizeof(struct snd_soc_dapm_route),
203 GFP_KERNEL);
204 if (!priv->dapm_routes)
205 return -ENOMEM;
206
207 for (i = 0; i < num_dai; i++) {
208 struct snd_soc_dai_link_component *dlc;
209
210 /* for CPU/Codec/Platform x 2 */
211 dlc = devm_kzalloc(&pdev->dev, 6 * sizeof(*dlc), GFP_KERNEL);
211 dlc = devm_kcalloc(&pdev->dev, 6, sizeof(*dlc), GFP_KERNEL);
212 if (!dlc) {
213 dev_err(&pdev->dev, "failed to allocate dai_link\n");
214 return -ENOMEM;
215 }
216
217 ret = of_parse_phandle_with_args(audmix_np, "dais", NULL, i,
218 &args);
219 if (ret < 0) {

--- 137 unchanged lines hidden ---
212 if (!dlc) {
213 dev_err(&pdev->dev, "failed to allocate dai_link\n");
214 return -ENOMEM;
215 }
216
217 ret = of_parse_phandle_with_args(audmix_np, "dais", NULL, i,
218 &args);
219 if (ret < 0) {

--- 137 unchanged lines hidden ---