All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: megaraid_sas: remove unnecessary memset
@ 2022-04-07  7:24 Wan Jiabing
  2022-04-07  7:34 ` Sumit Saxena
  2022-04-12  1:55 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Wan Jiabing @ 2022-04-07  7:24 UTC (permalink / raw)
  To: Kashyap Desai, Sumit Saxena, Shivasharan S, James E.J. Bottomley,
	Martin K. Petersen, megaraidlinux.pdl, linux-scsi, linux-kernel
  Cc: Wan Jiabing

instance->cmd_list is allocated by kcalloc(). The memory is set to zero.
It is unnecessary to call memset again.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 8bf72dbc33b7..33f3226023f3 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4466,8 +4466,6 @@ int megasas_alloc_cmds(struct megasas_instance *instance)
 		return -ENOMEM;
 	}
 
-	memset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) *max_cmd);
-
 	for (i = 0; i < max_cmd; i++) {
 		instance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd),
 						GFP_KERNEL);
-- 
2.35.1


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

* Re: [PATCH] scsi: megaraid_sas: remove unnecessary memset
  2022-04-07  7:24 [PATCH] scsi: megaraid_sas: remove unnecessary memset Wan Jiabing
@ 2022-04-07  7:34 ` Sumit Saxena
  2022-04-12  1:55 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Sumit Saxena @ 2022-04-07  7:34 UTC (permalink / raw)
  To: Wan Jiabing
  Cc: Kashyap Desai, Shivasharan S, James E.J. Bottomley,
	Martin K. Petersen, PDL,MEGARAIDLINUX, Linux SCSI List, LKML

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

On Thu, Apr 7, 2022 at 12:55 PM Wan Jiabing <wanjiabing@vivo.com> wrote:
>
> instance->cmd_list is allocated by kcalloc(). The memory is set to zero.
> It is unnecessary to call memset again.
>
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Thank you.
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 8bf72dbc33b7..33f3226023f3 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -4466,8 +4466,6 @@ int megasas_alloc_cmds(struct megasas_instance *instance)
>                 return -ENOMEM;
>         }
>
> -       memset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) *max_cmd);
> -
>         for (i = 0; i < max_cmd; i++) {
>                 instance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd),
>                                                 GFP_KERNEL);
> --
> 2.35.1
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

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

* Re: [PATCH] scsi: megaraid_sas: remove unnecessary memset
  2022-04-07  7:24 [PATCH] scsi: megaraid_sas: remove unnecessary memset Wan Jiabing
  2022-04-07  7:34 ` Sumit Saxena
@ 2022-04-12  1:55 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-04-12  1:55 UTC (permalink / raw)
  To: Wan Jiabing
  Cc: Kashyap Desai, Sumit Saxena, Shivasharan S, James E.J. Bottomley,
	Martin K. Petersen, megaraidlinux.pdl, linux-scsi, linux-kernel


Wan,

> instance->cmd_list is allocated by kcalloc(). The memory is set to
> zero.  It is unnecessary to call memset again.

Applied to 5.19/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2022-04-12  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07  7:24 [PATCH] scsi: megaraid_sas: remove unnecessary memset Wan Jiabing
2022-04-07  7:34 ` Sumit Saxena
2022-04-12  1:55 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.