The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2 0/4] ASoC: Intel: avs: Replace devm_kzalloc() with devm_kcalloc()
@ 2025-03-17 12:21 Ethan Carter Edwards
  2025-03-17 12:21 ` [PATCH v2 1/4] " Ethan Carter Edwards
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Ethan Carter Edwards @ 2025-03-17 12:21 UTC (permalink / raw)
  To: Cezary Rojewski, Liam Girdwood, Peter Ujfalusi, Bard Liao,
	Ranjani Sridharan, Kai Vehmanen, Pierre-Louis Bossart, Mark Brown,
	Jaroslav Kysela, Takashi Iwai
  Cc: gustavoars, linux-sound, linux-kernel, linux-hardening,
	Ethan Carter Edwards

Open coded arithmetic in allocator arguments is discouraged. Helper
functions like kcalloc or, in this case, devm_kcalloc are preferred. Not
only for readability purposes but safety purposes.

The changes move `devm_kzalloc(dev, sizeof(var) * n, GFP_KERNEL)` to
the helper function `devm_kcalloc(dev, n, sizeof(var), GFP_KERNEL)`.

Here is a series of four patches within the Intel/avs drivers that make
these changes. They are all compile tested only but should have no
effect on runtime behaviour.
    
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments
Link: https://github.com/KSPP/linux/issues/162

Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
---
Changes in v2:
- change subjects to include avs
- change commit message to Replace devm_kzalloc() with devm_kcalloc
- Change from Link: to [1]:
- Link to v1: https://lore.kernel.org/r/20250314-sound-avs-kcalloc-v1-0-985f2734c020@ethancedwards.com

---
Ethan Carter Edwards (4):
      ASoC: Intel: avs: Replace devm_kzalloc() with devm_kcalloc()
      ASoC: Intel: avs: ssm4567: Replace devm_kzalloc() with devm_kcalloc()
      ASoC: Intel: avs: max98373: Replace devm_kzalloc() with devm_kcalloc()
      ASoC: Intel: avs: max98927: Replace devm_kzalloc() with devm_kcalloc()

 sound/soc/intel/avs/boards/max98373.c | 2 +-
 sound/soc/intel/avs/boards/max98927.c | 2 +-
 sound/soc/intel/avs/boards/ssm4567.c  | 2 +-
 sound/soc/intel/avs/pcm.c             | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
---
base-commit: da920b7df701770e006928053672147075587fb2
change-id: 20250314-sound-avs-kcalloc-91cedbc47074

Best regards,
-- 
Ethan Carter Edwards <ethan@ethancedwards.com>


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

end of thread, other threads:[~2025-03-18 16:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17 12:21 [PATCH v2 0/4] ASoC: Intel: avs: Replace devm_kzalloc() with devm_kcalloc() Ethan Carter Edwards
2025-03-17 12:21 ` [PATCH v2 1/4] " Ethan Carter Edwards
2025-03-17 12:21 ` [PATCH v2 2/4] ASoC: Intel: avs: ssm4567: " Ethan Carter Edwards
2025-03-17 12:21 ` [PATCH v2 3/4] ASoC: Intel: avs: max98373: " Ethan Carter Edwards
2025-03-17 12:21 ` [PATCH v2 4/4] ASoC: Intel: avs: max98927: " Ethan Carter Edwards
2025-03-17 12:30 ` [PATCH v2 0/4] ASoC: Intel: avs: " Cezary Rojewski
2025-03-18 16:28 ` Mark Brown

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