]> Git Repo - linux.git/commitdiff
ASoC: topology: Return -ENOMEM on memory allocation failure
authorAmadeusz Sławiński <[email protected]>
Tue, 7 Feb 2023 21:04:28 +0000 (22:04 +0100)
committerMark Brown <[email protected]>
Tue, 7 Feb 2023 14:06:26 +0000 (14:06 +0000)
When handling error path, ret needs to be set to correct value.

Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Fixes: d29d41e28eea ("ASoC: topology: Add support for multiple kcontrol types to a widget")
Reviewed-by: Cezary Rojewski <[email protected]>
Signed-off-by: Amadeusz Sławiński <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
sound/soc/soc-topology.c

index c3be24b2fac5560a94293ef4f83872b0704b64ff..a79a2fb260b87e7beeac5ad143f06916aa6eba2b 100644 (file)
@@ -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;
This page took 0.054368 seconds and 4 git commands to generate.