mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Joe Perches <joe@perches.com>,
	james.smart@broadcom.com, ram.vegesna@broadcom.com,
	jejb@linux.ibm.com, martin.petersen@oracle.com, hare@suse.de,
	dwagner@suse.de
Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] scsi: elx: efct: Avoid a useless memset
Date: Thu, 9 Dec 2021 23:19:08 +0100	[thread overview]
Message-ID: <52c4bc82-f8eb-c884-dfd8-2579f6632517@wanadoo.fr> (raw)
In-Reply-To: <4208b3d08a677601c73889f78dd25e5c9f056a86.camel@perches.com>



Le 09/12/2021 à 22:57, Joe Perches a écrit :
> On Thu, 2021-12-09 at 22:51 +0100, Christophe JAILLET wrote:
>> 'io->sgl' is kzalloced just a few lines above. There is no need to memset
>> it another time.
> 
> Better to use kcalloc as well and delete the memset

Sure, thanks for spotting it Joe.

Should a clean v2 be sent or the patch in your reply is enough?
As your proposal is better than mine, if a v2 is needed, can you do it?

CJ


> 
>> diff --git a/drivers/scsi/elx/efct/efct_io.c b/drivers/scsi/elx/efct/efct_io.c
> []
>> @@ -62,7 +62,6 @@ efct_io_pool_create(struct efct *efct, u32 num_sgl)
>>   			return NULL;
>>   		}
>>   
>> -		memset(io->sgl, 0, sizeof(*io->sgl) * num_sgl);
>>   		io->sgl_allocated = num_sgl;
>>   		io->sgl_count = 0;
>>   
> 
> ---
>   drivers/scsi/elx/efct/efct_io.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/elx/efct/efct_io.c b/drivers/scsi/elx/efct/efct_io.c
> index 71e21655916a9..109483f3e3dfd 100644
> --- a/drivers/scsi/elx/efct/efct_io.c
> +++ b/drivers/scsi/elx/efct/efct_io.c
> @@ -56,13 +56,12 @@ efct_io_pool_create(struct efct *efct, u32 num_sgl)
>   		}
>   
>   		/* Allocate SGL */
> -		io->sgl = kzalloc(sizeof(*io->sgl) * num_sgl, GFP_KERNEL);
> +		io->sgl = kcalloc(num_sgl, sizeof(*io->sgl), GFP_KERNEL);
>   		if (!io->sgl) {
>   			efct_io_pool_free(io_pool);
>   			return NULL;
>   		}
>   
> -		memset(io->sgl, 0, sizeof(*io->sgl) * num_sgl);
>   		io->sgl_allocated = num_sgl;
>   		io->sgl_count = 0;
>   
> 
> 

  reply	other threads:[~2021-12-09 22:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09 21:51 Christophe JAILLET
2021-12-09 21:57 ` Joe Perches
2021-12-09 22:19   ` Christophe JAILLET [this message]
2021-12-09 22:29     ` Joe Perches

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=52c4bc82-f8eb-c884-dfd8-2579f6632517@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=james.smart@broadcom.com \
    --cc=jejb@linux.ibm.com \
    --cc=joe@perches.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ram.vegesna@broadcom.com \
    --cc=target-devel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®