From: tanze Date: Fri, 24 Oct 2025 10:55:49 +0000 (+0800) Subject: ALSA: maestro3: using vmalloc_array() to handle the code X-Git-Tag: v6.19-rc1~156^2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0deef0ed594a1e1a81a2bab13b7eb115cd59de6;p=thirdparty%2Fkernel%2Flinux.git ALSA: maestro3: using vmalloc_array() to handle the code Change array_size() to vmalloc_array(), due to vmalloc_array() being optimized better, using fewer instructions, and handles overflow more concisely. Signed-off-by: tanze Link: https://patch.msgid.link/20251024105549.210654-1-tanze@kylinos.cn Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index bddf47a1f263c..3353980d5cd8a 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -2571,9 +2571,9 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, if (IS_ENABLED(CONFIG_PM_SLEEP)) { chip->suspend_mem = - vmalloc(array_size(sizeof(u16), - REV_B_CODE_MEMORY_LENGTH + - REV_B_DATA_MEMORY_LENGTH)); + vmalloc_array(REV_B_CODE_MEMORY_LENGTH + + REV_B_DATA_MEMORY_LENGTH, + sizeof(u16)); if (!chip->suspend_mem) dev_warn(card->dev, "can't allocate apm buffer\n"); }