diff options
author | Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> | 2023-02-07 22:04:28 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-14 19:11:50 +0100 |
commit | dcfe5431fb0fcc130958f33472a6b8327e5cba8c (patch) | |
tree | 11277492ee852d15dfc4df36844841a4412c2a59 /sound | |
parent | 3b858f23cefb2398701459cf821b150523a791de (diff) | |
download | linux-stable-dcfe5431fb0fcc130958f33472a6b8327e5cba8c.tar.gz linux-stable-dcfe5431fb0fcc130958f33472a6b8327e5cba8c.tar.bz2 linux-stable-dcfe5431fb0fcc130958f33472a6b8327e5cba8c.zip |
ASoC: topology: Return -ENOMEM on memory allocation failure
[ Upstream commit c173ee5b2fa6195066674d66d1d7e191010fb1ff ]
When handling error path, ret needs to be set to correct value.
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Fixes: d29d41e28eea ("ASoC: topology: Add support for multiple kcontrol types to a widget")
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20230207210428.2076354-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-topology.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index c3be24b2fac5..a79a2fb260b8 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1401,13 +1401,17 @@ 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) + if (!kc) { + ret = -ENOMEM; goto hdr_err; + } kcontrol_type = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(unsigned int), GFP_KERNEL); - if (!kcontrol_type) + if (!kcontrol_type) { + ret = -ENOMEM; goto hdr_err; + } for (i = 0; i < le32_to_cpu(w->num_kcontrols); i++) { control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos; |