ASoC: amd: vangogh: use sizeof of variable instead of struct type
authorLucas Tanure <lucas.tanure@collabora.com>
Fri, 17 Feb 2023 11:08:44 +0000 (11:08 +0000)
committerMark Brown <broonie@kernel.org>
Sun, 5 Mar 2023 23:37:19 +0000 (23:37 +0000)
Use sizeof(*machine) instead of sizeof(struct acp5x_platform_info)

There is a possibility of bug when variable type has changed but
corresponding struct passed to the sizeof has not.

Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com>
Link: https://lore.kernel.org/r/20230217110850.1045250-4-lucas.tanure@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/amd/vangogh/acp5x-mach.c

index f914f6327cdaafc69417249fcf8fe2620d718ab8..43c80103d1387a439c42e33c01c3c2a9b8fcfe19 100644 (file)
@@ -342,7 +342,7 @@ static int acp5x_probe(struct platform_device *pdev)
        struct snd_soc_card *card;
        int ret;
 
-       machine = devm_kzalloc(dev, sizeof(struct acp5x_platform_info), GFP_KERNEL);
+       machine = devm_kzalloc(dev, sizeof(*machine), GFP_KERNEL);
        if (!machine)
                return -ENOMEM;