Re: [PATCH] scsi: elx: efct: Avoid a useless memset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2021-12-09 at 23:19 +0100, Christophe JAILLET wrote:
> 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?

Hi Christophe.

I just wondered about the multiplication in the memset.
You are the patch submitter and noticed it in the first place.
If needed I think you should do it.

cheers, Joe

> > diff --git 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;
> >   





[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux