diff options
author | 2020-06-12 15:59:38 -0500 | |
---|---|---|
committer | 2020-06-15 14:15:12 +0100 | |
commit | 6ae4902f2f3400503f9b78e87e8371e4ffde1e0c (patch) | |
tree | f0a413e638179c4f8ec673e899b58eeb28fcc032 /sound/soc/soc-topology.c | |
parent | ASoC: soc-devres: add devm_snd_soc_register_dai() (diff) | |
download | linux-6ae4902f2f3400503f9b78e87e8371e4ffde1e0c.tar.gz linux-6ae4902f2f3400503f9b78e87e8371e4ffde1e0c.tar.bz2 linux-6ae4902f2f3400503f9b78e87e8371e4ffde1e0c.zip |
ASoC: soc-topology: use devm_snd_soc_register_dai()
Use devm_ to avoid use-after-free KASAN reports and simplify error
handling.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
BugLink: https://github.com/thesofproject/linux/issues/2186
Link: https://lore.kernel.org/r/20200612205938.26415-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-topology.c')
-rw-r--r-- | sound/soc/soc-topology.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 9e89633676b7..43e5745b06aa 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1851,7 +1851,7 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg, list_add(&dai_drv->dobj.list, &tplg->comp->dobj_list); /* register the DAI to the component */ - dai = snd_soc_register_dai(tplg->comp, dai_drv, false); + dai = devm_snd_soc_register_dai(tplg->comp->dev, tplg->comp, dai_drv, false); if (!dai) return -ENOMEM; @@ -1859,7 +1859,6 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg, ret = snd_soc_dapm_new_dai_widgets(dapm, dai); if (ret != 0) { dev_err(dai->dev, "Failed to create DAI widgets %d\n", ret); - snd_soc_unregister_dai(dai); return ret; } |