diff options
author | Mark Brown <broonie@kernel.org> | 2022-09-07 16:37:12 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-09-07 16:37:12 +0300 |
commit | 5b16f2677b9c0b06d4d1107a541d5d4e7a4da404 (patch) | |
tree | 9e9a71f97d13a44bc33349dc9bbbc11790a6bd88 /sound | |
parent | e9d967679e803e7472f06642156f0bb029e26655 (diff) | |
parent | 3caac759681eeb31ac80e3cc14b972680c8bde54 (diff) | |
download | linux-5b16f2677b9c0b06d4d1107a541d5d4e7a4da404.tar.xz |
ASoC: soc-dapm.c: random cleanup
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
These are cleanup patches for soc-dapm.c.
Each patches are not related, very random cleanup.
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-dapm.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 73b8bd452ca7..76615d59e2b6 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3630,10 +3630,18 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, enum snd_soc_dapm_direction dir; struct snd_soc_dapm_widget *w; const char *prefix; - int ret; + int ret = -ENOMEM; if ((w = dapm_cnew_widget(widget)) == NULL) - return ERR_PTR(-ENOMEM); + goto cnew_failed; + + prefix = soc_dapm_prefix(dapm); + if (prefix) + w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); + else + w->name = kstrdup_const(widget->name, GFP_KERNEL); + if (!w->name) + goto name_failed; switch (w->id) { case snd_soc_dapm_regulator_supply: @@ -3672,17 +3680,6 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, break; } - prefix = soc_dapm_prefix(dapm); - if (prefix) - w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); - else - w->name = kstrdup_const(widget->name, GFP_KERNEL); - if (w->name == NULL) { - kfree_const(w->sname); - kfree(w); - return ERR_PTR(-ENOMEM); - } - switch (w->id) { case snd_soc_dapm_mic: w->is_ep = SND_SOC_DAPM_EP_SOURCE; @@ -3770,9 +3767,11 @@ request_failed: if (ret != -EPROBE_DEFER) dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n", w->name, ret); - + kfree_const(w->name); +name_failed: kfree_const(w->sname); kfree(w); +cnew_failed: return ERR_PTR(ret); } @@ -3885,7 +3884,7 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, * necessary */ config = rtd->dai_link->params + rtd->params_select; - if (WARN_ON(!config)) { + if (!config) { dev_err(w->dapm->dev, "ASoC: link config missing\n"); ret = -EINVAL; goto out; |