]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SDCA: Update memory allocations to zero initialise
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Tue, 15 Jul 2025 15:17:23 +0000 (16:17 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 15 Jul 2025 16:58:22 +0000 (17:58 +0100)
All the memory allocations in the SDCA ASoC helpers rely on fields being
zero initialised, the code should use kzalloc not kmalloc.

Reported-by: Shuming Fan <shumingf@realtek.com>
Fixes: 2c8b3a8e6aa8 ("ASoC: SDCA: Create DAPM widgets and routes from DisCo")
Fixes: c3ca24e3fcb6 ("ASoC: SDCA: Create ALSA controls from DisCo")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250715151723.2964336-4-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sdca/sdca_asoc.c

index dd7b19083c85f0965eaa2e2d80c4d79165b5fc69..ebb1c87facf9c5f4eb3515c0c3cceec628927f2e 100644 (file)
@@ -230,11 +230,11 @@ static int entity_early_parse_ge(struct device *dev,
        if (!control_name)
                return -ENOMEM;
 
-       kctl = devm_kmalloc(dev, sizeof(*kctl), GFP_KERNEL);
+       kctl = devm_kzalloc(dev, sizeof(*kctl), GFP_KERNEL);
        if (!kctl)
                return -ENOMEM;
 
-       soc_enum = devm_kmalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
+       soc_enum = devm_kzalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
        if (!soc_enum)
                return -ENOMEM;
 
@@ -561,11 +561,11 @@ static int entity_parse_su_class(struct device *dev,
        const char **texts;
        int i;
 
-       kctl = devm_kmalloc(dev, sizeof(*kctl), GFP_KERNEL);
+       kctl = devm_kzalloc(dev, sizeof(*kctl), GFP_KERNEL);
        if (!kctl)
                return -ENOMEM;
 
-       soc_enum = devm_kmalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
+       soc_enum = devm_kzalloc(dev, sizeof(*soc_enum), GFP_KERNEL);
        if (!soc_enum)
                return -ENOMEM;
 
@@ -672,7 +672,7 @@ static int entity_parse_mu(struct device *dev,
                if (!control_name)
                        return -ENOMEM;
 
-               mc = devm_kmalloc(dev, sizeof(*mc), GFP_KERNEL);
+               mc = devm_kzalloc(dev, sizeof(*mc), GFP_KERNEL);
                if (!mc)
                        return -ENOMEM;
 
@@ -926,7 +926,7 @@ static int populate_control(struct device *dev,
        if (!control_name)
                return -ENOMEM;
 
-       mc = devm_kmalloc(dev, sizeof(*mc), GFP_KERNEL);
+       mc = devm_kzalloc(dev, sizeof(*mc), GFP_KERNEL);
        if (!mc)
                return -ENOMEM;