]> Git Repo - J-linux.git/commitdiff
ASoC: soc-topology: use devm_snd_soc_register_dai()
authorPierre-Louis Bossart <[email protected]>
Fri, 12 Jun 2020 20:59:38 +0000 (15:59 -0500)
committerMark Brown <[email protected]>
Mon, 15 Jun 2020 13:15:12 +0000 (14:15 +0100)
Use devm_ to avoid use-after-free KASAN reports and simplify error
handling.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Bard Liao <[email protected]>
Reviewed-by: Kai Vehmanen <[email protected]>
BugLink: https://github.com/thesofproject/linux/issues/2186
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
sound/soc/soc-topology.c

index 9e89633676b710ac3411ceaa126e3e6049f47f8d..43e5745b06aa7fe91e96472f5289cf547bcf799a 100644 (file)
@@ -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;
        }
 
This page took 0.0653899999999999 seconds and 4 git commands to generate.