]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: Intel: avs: ssm4567: Replace devm_kzalloc() with devm_kcalloc()
authorEthan Carter Edwards <ethan@ethancedwards.com>
Mon, 17 Mar 2025 12:21:57 +0000 (08:21 -0400)
committerMark Brown <broonie@kernel.org>
Mon, 17 Mar 2025 12:33:00 +0000 (12:33 +0000)
Open coded arithmetic in allocator arguments is discouraged [1]. Helper
functions like kcalloc or, in this case, devm_kcalloc are preferred.

[1]: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments

Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20250317-sound-avs-kcalloc-v2-2-20e2a132b18f@ethancedwards.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/avs/boards/ssm4567.c

index c9d89bfe7178cd6acba0797c56e56462d7c41d8d..7667790d52739b98b97d2bc9fc9496da82affef1 100644 (file)
@@ -97,7 +97,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
        dl->name = devm_kasprintf(dev, GFP_KERNEL,
                                  AVS_STRING_FMT("SSP", "-Codec", ssp_port, tdm_slot));
        dl->cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL);
-       dl->codecs = devm_kzalloc(dev, sizeof(*dl->codecs) * 2, GFP_KERNEL);
+       dl->codecs = devm_kcalloc(dev, 2, sizeof(*dl->codecs), GFP_KERNEL);
        if (!dl->name || !dl->cpus || !dl->codecs)
                return -ENOMEM;