]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: Intel: avs: max98927: Replace devm_kzalloc() with devm_kcalloc()
authorEthan Carter Edwards <ethan@ethancedwards.com>
Mon, 17 Mar 2025 12:21:59 +0000 (08:21 -0400)
committerMark Brown <broonie@kernel.org>
Mon, 17 Mar 2025 12:33:02 +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-4-20e2a132b18f@ethancedwards.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/avs/boards/max98927.c

index e8e5d1c717cd398aeca506bf7d20b5819d8dd1a2..e4ce553bf1d6432b4c11ce44857d969ca6b54c83 100644 (file)
@@ -108,7 +108,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;