Linux Sound subsystem development
 help / color / mirror / Atom feed
From: tanze <tanze@kylinos.cn>
To: phasta@mailbox.org, perex@perex.cz, phasta@kernel.org, tiwai@suse.com
Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org,
	tanze <tanze@kylinos.cn>
Subject: [PATCH v2] ALSA: maestro3: using vmalloc_array() to handle the code
Date: Fri, 24 Oct 2025 18:55:49 +0800	[thread overview]
Message-ID: <20251024105549.210654-1-tanze@kylinos.cn> (raw)

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>
---
Hi, Philipp Stanner,

Thank you for your suggestions.
I have made revisions according to your requirements.

Regarding the issue of my full name, thank you for your 
attention to detail. Since I am in China, I use the name 
"tanze" on many occasions, and the code I previously submitted 
to the upstream community was also under this name.
---
Changes in v2:
 - Fix some issues in the commit message.

v1:
 - patch: https://lore.kernel.org/all/20251022092339.551438-1-tanze@kylinos.cn/

Best regards,
Ze Tan 
---
 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


             reply	other threads:[~2025-10-24 10:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24 10:55 tanze [this message]
2025-10-24 11:05 ` [PATCH v2] ALSA: maestro3: using vmalloc_array() to handle the code Philipp Stanner
2025-10-27  9:08 ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251024105549.210654-1-tanze@kylinos.cn \
    --to=tanze@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=phasta@kernel.org \
    --cc=phasta@mailbox.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox