lkml.org 
[lkml]   [2020]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.6 08/79] ASoC: topology: Check return value of soc_tplg_create_tlv
    Date
    From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

    [ Upstream commit 482db55ae87f3749db05810a38b1d618dfd4407c ]

    Function soc_tplg_create_tlv can fail, so we should check if it succeded
    or not and proceed appropriately.

    Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
    Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
    Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20200327204729.397-3-amadeuszx.slawinski@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    sound/soc/soc-topology.c | 16 ++++++++++++++--
    1 file changed, 14 insertions(+), 2 deletions(-)

    diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
    index 7a7c427de95d6..5d974a36cdc92 100644
    --- a/sound/soc/soc-topology.c
    +++ b/sound/soc/soc-topology.c
    @@ -894,7 +894,13 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count,
    }

    /* create any TLV data */
    - soc_tplg_create_tlv(tplg, &kc, &mc->hdr);
    + err = soc_tplg_create_tlv(tplg, &kc, &mc->hdr);
    + if (err < 0) {
    + dev_err(tplg->dev, "ASoC: failed to create TLV %s\n",
    + mc->hdr.name);
    + kfree(sm);
    + continue;
    + }

    /* pass control to driver for optional further init */
    err = soc_tplg_init_kcontrol(tplg, &kc,
    @@ -1355,7 +1361,13 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dmixer_create(
    }

    /* create any TLV data */
    - soc_tplg_create_tlv(tplg, &kc[i], &mc->hdr);
    + err = soc_tplg_create_tlv(tplg, &kc[i], &mc->hdr);
    + if (err < 0) {
    + dev_err(tplg->dev, "ASoC: failed to create TLV %s\n",
    + mc->hdr.name);
    + kfree(sm);
    + continue;
    + }

    /* pass control to driver for optional further init */
    err = soc_tplg_init_kcontrol(tplg, &kc[i],
    --
    2.20.1
    \
     
     \ /
      Last update: 2020-04-30 15:51    [W:4.281 / U:0.264 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site