Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <tanze@kylinos.cn>
Link: https://patch.msgid.link/20251024105549.210654-1-tanze@kylinos.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

tanze and committed by
Takashi Iwai
a0deef0e 28bcb216

+3 -3
+3 -3
sound/pci/maestro3.c
··· 2571 2571 2572 2572 if (IS_ENABLED(CONFIG_PM_SLEEP)) { 2573 2573 chip->suspend_mem = 2574 - vmalloc(array_size(sizeof(u16), 2575 - REV_B_CODE_MEMORY_LENGTH + 2576 - REV_B_DATA_MEMORY_LENGTH)); 2574 + vmalloc_array(REV_B_CODE_MEMORY_LENGTH + 2575 + REV_B_DATA_MEMORY_LENGTH, 2576 + sizeof(u16)); 2577 2577 if (!chip->suspend_mem) 2578 2578 dev_warn(card->dev, "can't allocate apm buffer\n"); 2579 2579 }