Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] use kzalloc
@ 2022-03-12 10:26 Julia Lawall
  2022-03-12 10:27 ` [PATCH 3/6] ALSA: seq: oss: " Julia Lawall
  2022-03-14 20:30 ` [PATCH 0/6] " patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Julia Lawall @ 2022-03-12 10:26 UTC (permalink / raw)
  To: linux-wireless
  Cc: linux-cifs, alsa-devel, linux-scsi, kernel-janitors, netdev,
	linux-usb, samba-technical, linux-kernel, linux-rdma,
	Andrey Konovalov

Use kzalloc instead of kmalloc + memset.

---

 drivers/net/ethernet/mellanox/mlx4/en_rx.c |    3 +--
 drivers/net/wireless/zydas/zd1201.c        |    3 +--
 drivers/scsi/lpfc/lpfc_debugfs.c           |    9 ++-------
 drivers/usb/gadget/legacy/raw_gadget.c     |    3 +--
 fs/cifs/transport.c                        |    3 +--
 sound/core/seq/oss/seq_oss_init.c          |    3 +--
 6 files changed, 7 insertions(+), 17 deletions(-)

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

* [PATCH 3/6] ALSA: seq: oss: use kzalloc
  2022-03-12 10:26 [PATCH 0/6] use kzalloc Julia Lawall
@ 2022-03-12 10:27 ` Julia Lawall
  2022-03-12 21:43   ` Joe Perches
  2022-03-13  8:09   ` Takashi Iwai
  2022-03-14 20:30 ` [PATCH 0/6] " patchwork-bot+netdevbpf
  1 sibling, 2 replies; 5+ messages in thread
From: Julia Lawall @ 2022-03-12 10:27 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel, kernel-janitors, Takashi Iwai, linux-kernel

Use kzalloc instead of kmalloc + memset.

The semantic patch that makes this change is:
(https://coccinelle.gitlabpages.inria.fr/website/)

//<smpl>
@@
expression res, size, flag;
@@
- res = kmalloc(size, flag);
+ res = kzalloc(size, flag);
  ...
- memset(res, 0, size);
//</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

---
 sound/core/seq/oss/seq_oss_init.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
index 0ee4a5081fd6..04a3376a6e66 100644
--- a/sound/core/seq/oss/seq_oss_init.c
+++ b/sound/core/seq/oss/seq_oss_init.c
@@ -66,7 +66,7 @@ snd_seq_oss_create_client(void)
 	struct snd_seq_port_info *port;
 	struct snd_seq_port_callback port_callback;
 
-	port = kmalloc(sizeof(*port), GFP_KERNEL);
+	port = kzalloc(sizeof(*port), GFP_KERNEL);
 	if (!port) {
 		rc = -ENOMEM;
 		goto __error;
@@ -81,7 +81,6 @@ snd_seq_oss_create_client(void)
 	system_client = rc;
 
 	/* create annoucement receiver port */
-	memset(port, 0, sizeof(*port));
 	strcpy(port->name, "Receiver");
 	port->addr.client = system_client;
 	port->capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */


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

* Re: [PATCH 3/6] ALSA: seq: oss: use kzalloc
  2022-03-12 10:27 ` [PATCH 3/6] ALSA: seq: oss: " Julia Lawall
@ 2022-03-12 21:43   ` Joe Perches
  2022-03-13  8:09   ` Takashi Iwai
  1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2022-03-12 21:43 UTC (permalink / raw)
  To: Julia Lawall, Jaroslav Kysela
  Cc: alsa-devel, kernel-janitors, Takashi Iwai, linux-kernel

On Sat, 2022-03-12 at 11:27 +0100, Julia Lawall wrote:
> Use kzalloc instead of kmalloc + memset.
[]
> diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
[]
> @@ -81,7 +81,6 @@ snd_seq_oss_create_client(void)
>  	system_client = rc;
>  
>  	/* create annoucement receiver port */

unrelated trivia: typo of announcement above

> -	memset(port, 0, sizeof(*port));
>  	strcpy(port->name, "Receiver");
>  	port->addr.client = system_client;
>  	port->capability = SNDRV_SEQ_PORT_CAP_WRITE; /* receive only */
> 



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

* Re: [PATCH 3/6] ALSA: seq: oss: use kzalloc
  2022-03-12 10:27 ` [PATCH 3/6] ALSA: seq: oss: " Julia Lawall
  2022-03-12 21:43   ` Joe Perches
@ 2022-03-13  8:09   ` Takashi Iwai
  1 sibling, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2022-03-13  8:09 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-kernel, alsa-devel, kernel-janitors, Takashi Iwai

On Sat, 12 Mar 2022 11:27:02 +0100,
Julia Lawall wrote:
> 
> Use kzalloc instead of kmalloc + memset.
> 
> The semantic patch that makes this change is:
> (https://coccinelle.gitlabpages.inria.fr/website/)
> 
> //<smpl>
> @@
> expression res, size, flag;
> @@
> - res = kmalloc(size, flag);
> + res = kzalloc(size, flag);
>   ...
> - memset(res, 0, size);
> //</smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Applied, thanks.


Takashi

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

* Re: [PATCH 0/6] use kzalloc
  2022-03-12 10:26 [PATCH 0/6] use kzalloc Julia Lawall
  2022-03-12 10:27 ` [PATCH 3/6] ALSA: seq: oss: " Julia Lawall
@ 2022-03-14 20:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-14 20:30 UTC (permalink / raw)
  To: Julia Lawall
  Cc: linux-cifs, alsa-devel, linux-scsi, linux-rdma, linux-wireless,
	linux-usb, kernel-janitors, linux-kernel, netdev, samba-technical,
	andreyknvl

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 12 Mar 2022 11:26:59 +0100 you wrote:
> Use kzalloc instead of kmalloc + memset.
> 
> ---
> 
>  drivers/net/ethernet/mellanox/mlx4/en_rx.c |    3 +--
>  drivers/net/wireless/zydas/zd1201.c        |    3 +--
>  drivers/scsi/lpfc/lpfc_debugfs.c           |    9 ++-------
>  drivers/usb/gadget/legacy/raw_gadget.c     |    3 +--
>  fs/cifs/transport.c                        |    3 +--
>  sound/core/seq/oss/seq_oss_init.c          |    3 +--
>  6 files changed, 7 insertions(+), 17 deletions(-)

Here is the summary with links:
  - [2/6] net/mlx4_en: use kzalloc
    https://git.kernel.org/netdev/net-next/c/3c2dfb735b4a
  - [5/6] zd1201: use kzalloc
    (no matching commit)

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-03-17  6:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-12 10:26 [PATCH 0/6] use kzalloc Julia Lawall
2022-03-12 10:27 ` [PATCH 3/6] ALSA: seq: oss: " Julia Lawall
2022-03-12 21:43   ` Joe Perches
2022-03-13  8:09   ` Takashi Iwai
2022-03-14 20:30 ` [PATCH 0/6] " patchwork-bot+netdevbpf

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