Skip to contentSkip to conversation

drivers/scsi/snic/snic_trc.c: Use vzalloc

PATCH In review Sabyasachi Gupta 2 participants 4 messages Nov 15, 2018 – Dec 5, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/scsi/snic/snic_trc.c: Use vzalloc

Replaced vmalloc + memset with vzalloc

---
 drivers/scsi/snic/snic_trc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/snic/snic_trc.c +1 -2
index fc60c93..458eaba 100644
@@ -126,7 +126,7 @@ snic_trc_init(void)
 	int tbuf_sz = 0, ret;
 
 	tbuf_sz = (snic_trace_max_pages * PAGE_SIZE);
-	tbuf = vmalloc(tbuf_sz);
+	tbuf = vzalloc(tbuf_sz);
 	if (!tbuf) {
 		SNIC_ERR("Failed to Allocate Trace Buffer Size. %d\n", tbuf_sz);
 		SNIC_ERR("Trace Facility not enabled.\n");
@@ -135,7 +135,6 @@ snic_trc_init(void)
 		return ret;
 	}
 
-	memset(tbuf, 0, tbuf_sz);
 	trc->buf = (struct snic_trc_data *) tbuf;
 	spin_lock_init(&trc->lock);
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 4 lines · Sabyasachi Gupta

Replaced vmalloc + memset with vzalloc

Any comment on this patch?

Quoted 28 lines
---
 drivers/scsi/snic/snic_trc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/snic/snic_trc.c +1 -3
index fc60c93..458eaba 100644
@@ -126,7 +126,7 @@ snic_trc_init(void)
        int tbuf_sz = 0, ret;
 
        tbuf_sz = (snic_trace_max_pages * PAGE_SIZE);
-       tbuf = vmalloc(tbuf_sz);
+       tbuf = vzalloc(tbuf_sz);
        if (!tbuf) {
                SNIC_ERR("Failed to Allocate Trace Buffer Size. %d\n", tbuf_sz);
                SNIC_ERR("Trace Facility not enabled.\n");
@@ -135,7 +135,6 @@ snic_trc_init(void)
                return ret;
        }
 
-       memset(tbuf, 0, tbuf_sz);
        trc->buf = (struct snic_trc_data *) tbuf;
        spin_lock_init(&trc->lock);
 
--

2.7.4

#2 lore raw
Quoted 9 lines · Sabyasachi Gupta
Quoted 4 lines · Sabyasachi Gupta

Replaced vmalloc + memset with vzalloc

Any comment on this patch?

Any comment on this patch?

Quoted 29 lines
Quoted 29 lines
---
 drivers/scsi/snic/snic_trc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/snic/snic_trc.c +1 -3
index fc60c93..458eaba 100644
@@ -126,7 +126,7 @@ snic_trc_init(void)
        int tbuf_sz = 0, ret;
 
        tbuf_sz = (snic_trace_max_pages * PAGE_SIZE);
-       tbuf = vmalloc(tbuf_sz);
+       tbuf = vzalloc(tbuf_sz);
        if (!tbuf) {
                SNIC_ERR("Failed to Allocate Trace Buffer Size. %d\n", tbuf_sz);
                SNIC_ERR("Trace Facility not enabled.\n");
@@ -135,7 +135,6 @@ snic_trc_init(void)
                return ret;
        }
 
-       memset(tbuf, 0, tbuf_sz);
        trc->buf = (struct snic_trc_data *) tbuf;
        spin_lock_init(&trc->lock);
 
--

2.7.4

maintainer Acked-by
#3 lore raw

Looks good to me.

On 12/4/18, 8:33 PM, "Sabyasachi Gupta" <[email protected]> wrote:

    On Fri, Nov 23, 2018 at 8:07 PM Sabyasachi Gupta
    <[email protected]> wrote:
    >
    > On Thu, Nov 15, 2018 at 10:04 PM Sabyasachi Gupta
    > <[email protected]> wrote:
    > >
    > > Replaced vmalloc + memset with vzalloc
    > >
    > > Signed-off-by: Sabyasachi Gupta <[email protected]>
    >
    > Any comment on this patch?
    
    Any comment on this patch?
    
    >
    > > ---
    > >  drivers/scsi/snic/snic_trc.c | 3 +--
    > >  1 file changed, 1 insertion(+), 2 deletions(-)
    > >
    > > diff --git a/drivers/scsi/snic/snic_trc.c b/drivers/scsi/snic/snic_trc.c
    > > index fc60c93..458eaba 100644
    > > --- a/drivers/scsi/snic/snic_trc.c
    > > +++ b/drivers/scsi/snic/snic_trc.c
    > > @@ -126,7 +126,7 @@ snic_trc_init(void)
    > >         int tbuf_sz = 0, ret;
    > >
    > >         tbuf_sz = (snic_trace_max_pages * PAGE_SIZE);
    > > -       tbuf = vmalloc(tbuf_sz);
    > > +       tbuf = vzalloc(tbuf_sz);
    > >         if (!tbuf) {
    > >                 SNIC_ERR("Failed to Allocate Trace Buffer Size. %d\n", tbuf_sz);
    > >                 SNIC_ERR("Trace Facility not enabled.\n");
    > > @@ -135,7 +135,6 @@ snic_trc_init(void)
    > >                 return ret;
    > >         }
    > >
    > > -       memset(tbuf, 0, tbuf_sz);
    > >         trc->buf = (struct snic_trc_data *) tbuf;
    > >         spin_lock_init(&trc->lock);
    > >
    > > --
    > > 2.7.4
    > >