public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Om Narasimhan <om.turyx@gmail.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@lists.osdl.org
Subject: Re: [KJ] kmalloc to kzalloc patches for drivers/block [sane version]
Date: Fri, 22 Sep 2006 10:43:08 +0200	[thread overview]
Message-ID: <4513A21C.40704@gmail.com> (raw)
In-Reply-To: <6b4e42d10609212304o52bbc9b4y434bbd7ef71281e3@mail.gmail.com>

Om Narasimhan wrote:
> Comments incorporated
> Changes kmalloc() calls succeeded by memset(,0,) to kzalloc()
> 
> Signed off by : Om Narasimhan <om.turyx@gmail.com>
> drivers/block/cciss.c    |    4 +---
> drivers/block/cpqarray.c |    7 ++-----
> drivers/block/loop.c     |    3 +--
> 3 files changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index 2cd3391..a800a69 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -900,7 +900,7 @@ #if 0                /* 'buf_size' member is 16-bits
>                 return -EINVAL;
> #endif
>             if (iocommand.buf_size > 0) {
> -                buff = kmalloc(iocommand.buf_size, GFP_KERNEL);
> +                buff = kzalloc(iocommand.buf_size, GFP_KERNEL);
>                 if (buff == NULL)
>                     return -EFAULT;
>             }
> @@ -911,8 +911,6 @@ #endif
>                     kfree(buff);
>                     return -EFAULT;
>                 }
> -            } else {
> -                memset(buff, 0, iocommand.buf_size);

No.

>             }
>             if ((c = cmd_alloc(host, 0)) == NULL) {
>                 kfree(buff);
> diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
> index 78082ed..34f8e96 100644
> --- a/drivers/block/cpqarray.c
> +++ b/drivers/block/cpqarray.c
> @@ -424,7 +424,7 @@ static int __init cpqarray_register_ctlr
>     hba[i]->cmd_pool = (cmdlist_t *)pci_alloc_consistent(
>         hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t),
>         &(hba[i]->cmd_pool_dhandle));
> -    hba[i]->cmd_pool_bits = kmalloc(
> +    hba[i]->cmd_pool_bits = kzalloc(
>         ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long),
>         GFP_KERNEL);

kcalloc?

> @@ -432,7 +432,6 @@ static int __init cpqarray_register_ctlr
>             goto Enomem1;
> 
>     memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t));
> -    memset(hba[i]->cmd_pool_bits, 0,
> ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long));

What's this? Wrapped? kcalloc?

>     printk(KERN_INFO "cpqarray: Finding drives on %s",
>         hba[i]->devname);
> 
> @@ -523,7 +522,6 @@ static int __init cpqarray_init_one( str
>     i = alloc_cpqarray_hba();
>     if( i < 0 )
>         return (-1);
> -    memset(hba[i], 0, sizeof(ctlr_info_t));
>     sprintf(hba[i]->devname, "ida%d", i);
>     hba[i]->ctlr = i;
>     /* Initialize the pdev driver private data */
> @@ -580,7 +578,7 @@ static int alloc_cpqarray_hba(void)
> 
>     for(i=0; i< MAX_CTLR; i++) {
>         if (hba[i] == NULL) {
> -            hba[i] = kmalloc(sizeof(ctlr_info_t), GFP_KERNEL);
> +            hba[i] = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL);
>             if(hba[i]==NULL) {
>                 printk(KERN_ERR "cpqarray: out of memory.\n");
>                 return (-1);
> @@ -765,7 +763,6 @@ static int __init cpqarray_eisa_detect(v
>             continue;
>         }
> 
> -        memset(hba[ctlr], 0, sizeof(ctlr_info_t));
>         hba[ctlr]->io_mem_addr = eisa[i];
>         hba[ctlr]->io_mem_length = 0x7FF;
>         if(!request_region(hba[ctlr]->io_mem_addr,
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 7b3b94d..91b48ef 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -1260,10 +1260,9 @@ static int __init loop_init(void)
>     if (register_blkdev(LOOP_MAJOR, "loop"))
>         return -EIO;
> 
> -    loop_dev = kmalloc(max_loop * sizeof(struct loop_device), GFP_KERNEL);
> +    loop_dev = kzalloc(max_loop * sizeof(struct loop_device), GFP_KERNEL);

kcalloc?

regards,
-- 
http://www.fi.muni.cz/~xslaby/            Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8  22A0 32CC 55C3 39D4 7A7E

  reply	other threads:[~2006-09-22  8:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-21  6:11 kmalloc to kzalloc patches for drivers/block [sane version] Om Narasimhan
2006-09-21  7:20 ` [KJ] " Nishanth Aravamudan
2006-09-22  5:40   ` Om Narasimhan
2006-09-22  6:04     ` Om Narasimhan
2006-09-22  8:43       ` Jiri Slaby [this message]
2006-09-22 11:32         ` Paulo Marques
2006-09-22 12:03           ` Pekka Enberg
2006-09-22 13:03             ` Paulo Marques
2006-09-22 13:45               ` Dmitry Torokhov
2006-09-22 22:55                 ` Om Narasimhan
2006-09-22  8:36     ` Jiri Slaby
2006-09-22 11:28       ` Paulo Marques

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=4513A21C.40704@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=om.turyx@gmail.com \
    /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