ASoC: SDCA: Update memory allocations to zero initialise

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: 2c8b3a8e6a ("ASoC: SDCA: Create DAPM widgets and routes from DisCo")
Fixes: c3ca24e3fc ("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>
This commit is contained in:
Charles Keepax
2025-07-15 16:17:23 +01:00
committed by Mark Brown
parent 71562278a1
commit 15247b5a63

View 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;