[PATCH 3/3] ALSA: maestro3: use vmalloc_array() to simplify code

Qianfeng Rong posted 3 patches 1 month, 1 week ago
[PATCH 3/3] ALSA: maestro3: use vmalloc_array() to simplify code
Posted by Qianfeng Rong 1 month, 1 week ago
Remove array_size() calls and replace vmalloc() with vmalloc_array() in
snd_m3_create() to simplify the code.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 sound/pci/maestro3.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index e092097599ff..0170b432402b 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2580,9 +2580,8 @@ 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");
 	}
-- 
2.34.1