[PATCH] ALSA:emu10k1 : Use vmalloc_array() instead of array_size in snd_emu10k1_efx_alloc_pm_buffer()

longlong yan posted 1 patch 1 week, 3 days ago
sound/pci/emu10k1/emufx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] ALSA:emu10k1 : Use vmalloc_array() instead of array_size in snd_emu10k1_efx_alloc_pm_buffer()
Posted by longlong yan 1 week, 3 days ago
Change array_size() to vmalloc_array(), due to vmalloc_array()
being optimized better, using fewer instructions, and handles
overflow more concisely

Fixes: 09668b441dac ("[ALSA] emu10k1 - Add PM support")
Signed-off-by: longlong yan <yanlonglong@kylinos.cn>
---
 sound/pci/emu10k1/emufx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 08e0556bf161..70b73b0439d7 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -2625,7 +2625,7 @@ int snd_emu10k1_efx_alloc_pm_buffer(struct snd_emu10k1 *emu)
 	if (! emu->tram_val_saved || ! emu->tram_addr_saved)
 		return -ENOMEM;
 	len = emu->audigy ? 2 * 1024 : 2 * 512;
-	emu->saved_icode = vmalloc(array_size(len, 4));
+	emu->saved_icode = vmalloc_array(len, 4);
 	if (! emu->saved_icode)
 		return -ENOMEM;
 	return 0;
-- 
2.43.0