]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: maestro3: using vmalloc_array() to handle the code
authortanze <tanze@kylinos.cn>
Fri, 24 Oct 2025 10:55:49 +0000 (18:55 +0800)
committerTakashi Iwai <tiwai@suse.de>
Mon, 27 Oct 2025 09:04:51 +0000 (10:04 +0100)
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 <tanze@kylinos.cn>
Link: https://patch.msgid.link/20251024105549.210654-1-tanze@kylinos.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/maestro3.c

index bddf47a1f263c472d7305679b4bcdf40013d353c..3353980d5cd8a256dcb68fe51c97a46d8a649ffa 100644 (file)
@@ -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");
        }