mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: maestro3: using vmalloc_array() to handle the code
@ 2025-10-22  9:23 tanze
  2025-10-22  9:56 ` Philipp Stanner
  0 siblings, 1 reply; 2+ messages in thread
From: tanze @ 2025-10-22  9:23 UTC (permalink / raw)
  To: perex, tiwai, phasta, linux-sound; +Cc: linux-kernel, tanze

Change array_size() to vmalloc_array(), Due to vmalloc_array()
is optimized better,uses fewer instructions, and handles
overflow more concisely

Signed-off-by: tanze <tanze@kylinos.cn>
---
 sound/pci/maestro3.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index bddf47a1f263..3353980d5cd8 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");
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: maestro3: using vmalloc_array() to handle the code
  2025-10-22  9:23 [PATCH] ALSA: maestro3: using vmalloc_array() to handle the code tanze
@ 2025-10-22  9:56 ` Philipp Stanner
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Stanner @ 2025-10-22  9:56 UTC (permalink / raw)
  To: tanze, perex, tiwai, phasta, linux-sound; +Cc: linux-kernel

On Wed, 2025-10-22 at 17:23 +0800, tanze wrote:
> Change array_size() to vmalloc_array(), Due to vmalloc_array()

s/Due/due

> is optimized better,uses fewer instructions, and handles

s/is/being
s/,/, /
s/uses/using
s/handles/handling

> overflow more concisely

full stop: '.'

> 
> Signed-off-by: tanze <tanze@kylinos.cn>

Is that your full name? Signed-off-by is basically a 'legal' statement
declaring that you as the code's author agree with the license and
stuff and declare that you're allowed (by your employer for example) to
upstream this code.


P.

> ---
>  sound/pci/maestro3.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
> index bddf47a1f263..3353980d5cd8 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");
>  	}


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-22  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-22  9:23 [PATCH] ALSA: maestro3: using vmalloc_array() to handle the code tanze
2025-10-22  9:56 ` Philipp Stanner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®