lkml.org 
[lkml]   [2022]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.17 012/146] ASoC: topology: Correct error handling in soc_tplg_dapm_widget_create()
    Date
    From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

    [ Upstream commit 9c363532413cda3e2c6dfa10e5cca7cd221877a0 ]

    Academic correction of error handling:
    In case the allocation of kc or kcontrol_type fails the correct label to
    jump is hdr_err since the template.sname has been also allocated at this
    point.

    Fixes: d29d41e28eea6 ("ASoC: topology: Add support for multiple kcontrol types to a widget")
    Signed-off-by: Peter Ujfalusi <peter.ujfalusi@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/20220331114957.519-1-peter.ujfalusi@linux.intel.com
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    sound/soc/soc-topology.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
    index cb24805668bd..f413238117af 100644
    --- a/sound/soc/soc-topology.c
    +++ b/sound/soc/soc-topology.c
    @@ -1479,12 +1479,12 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
    template.num_kcontrols = le32_to_cpu(w->num_kcontrols);
    kc = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(*kc), GFP_KERNEL);
    if (!kc)
    - goto err;
    + goto hdr_err;

    kcontrol_type = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(unsigned int),
    GFP_KERNEL);
    if (!kcontrol_type)
    - goto err;
    + goto hdr_err;

    for (i = 0; i < le32_to_cpu(w->num_kcontrols); i++) {
    control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos;
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-04-26 11:20    [W:4.135 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site