ASoC: imx-card: Adjust over allocation of memory in imx_card_parse_of()
authorChenyuan Yang <chenyuan0y@gmail.com>
Sun, 6 Apr 2025 21:08:54 +0000 (16:08 -0500)
committerMark Brown <broonie@kernel.org>
Sun, 13 Apr 2025 19:20:36 +0000 (20:20 +0100)
Incorrect types are used as sizeof() arguments in devm_kcalloc().
It should be sizeof(dai_link_data) for link_data instead of
sizeof(snd_soc_dai_link).

This is found by our static analysis tool.

Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
Link: https://patch.msgid.link/20250406210854.149316-1-chenyuan0y@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/imx-card.c

index 3686d468506b35b75352127cb9d2b0d1d5317e33..45e000f61eccac14d134bd16d64209f21e7ce207 100644 (file)
@@ -544,7 +544,7 @@ static int imx_card_parse_of(struct imx_card_data *data)
        if (!card->dai_link)
                return -ENOMEM;
 
-       data->link_data = devm_kcalloc(dev, num_links, sizeof(*link), GFP_KERNEL);
+       data->link_data = devm_kcalloc(dev, num_links, sizeof(*link_data), GFP_KERNEL);
        if (!data->link_data)
                return -ENOMEM;