From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Burman Yan <yan_952@hotmail.com>
Cc: linux-kernel@vger.kernel.org, trivial@kernel.org
Subject: Re: [PATCH 2.6.19-rc6] serial: replace kmalloc+memset with kzalloc
Date: Wed, 22 Nov 2006 19:12:17 +0000 [thread overview]
Message-ID: <20061122191217.GB22601@flint.arm.linux.org.uk> (raw)
In-Reply-To: <BAY20-F16EB95A16D5DB8549DE6A1D8E30@phx.gbl>
On Wed, Nov 22, 2006 at 08:57:33PM +0200, Burman Yan wrote:
> diff -rubp linux-2.6.19-rc5_orig/drivers/serial/8250_acorn.c linux-2.6.19-rc5_kzalloc/drivers/serial/8250_acorn.c
> --- linux-2.6.19-rc5_orig/drivers/serial/8250_acorn.c 2006-11-09 12:16:21.000000000 +0200
> +++ linux-2.6.19-rc5_kzalloc/drivers/serial/8250_acorn.c 2006-11-11 22:44:04.000000000 +0200
> @@ -47,11 +47,10 @@ serial_card_probe(struct expansion_card
> unsigned long bus_addr;
> unsigned int i;
>
> - info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL);
> + info = kzalloc(sizeof(struct serial_card_info), GFP_KERNEL);
> if (!info)
> return -ENOMEM;
>
> - memset(info, 0, sizeof(struct serial_card_info));
> info->num_ports = type->num_ports;
>
> bus_addr = ecard_resource_start(ec, type->type);
> diff -rubp linux-2.6.19-rc5_orig/drivers/serial/8250_pci.c linux-2.6.19-rc5_kzalloc/drivers/serial/8250_pci.c
> --- linux-2.6.19-rc5_orig/drivers/serial/8250_pci.c 2006-11-09 12:16:21.000000000 +0200
> +++ linux-2.6.19-rc5_kzalloc/drivers/serial/8250_pci.c 2006-11-11 22:44:18.000000000 +0200
> @@ -1614,7 +1614,7 @@ pciserial_init_ports(struct pci_dev *dev
> nr_ports = rc;
> }
>
> - priv = kmalloc(sizeof(struct serial_private) +
> + priv = kzalloc(sizeof(struct serial_private) +
> sizeof(unsigned int) * nr_ports,
> GFP_KERNEL);
> if (!priv) {
> @@ -1622,9 +1622,6 @@ pciserial_init_ports(struct pci_dev *dev
> goto err_deinit;
> }
>
> - memset(priv, 0, sizeof(struct serial_private) +
> - sizeof(unsigned int) * nr_ports);
> -
> priv->dev = dev;
> priv->quirk = quirk;
>
> diff -rubp linux-2.6.19-rc5_orig/drivers/serial/serial_core.c linux-2.6.19-rc5_kzalloc/drivers/serial/serial_core.c
> --- linux-2.6.19-rc5_orig/drivers/serial/serial_core.c 2006-11-09 12:16:21.000000000 +0200
> +++ linux-2.6.19-rc5_kzalloc/drivers/serial/serial_core.c 2006-11-11 22:44:04.000000000 +0200
> @@ -1523,9 +1523,8 @@ static struct uart_state *uart_get(struc
> }
>
> if (!state->info) {
> - state->info = kmalloc(sizeof(struct uart_info), GFP_KERNEL);
> + state->info = kzalloc(sizeof(struct uart_info), GFP_KERNEL);
> if (state->info) {
> - memset(state->info, 0, sizeof(struct uart_info));
> init_waitqueue_head(&state->info->open_wait);
> init_waitqueue_head(&state->info->delta_msr_wait);
>
> @@ -2167,13 +2166,11 @@ int uart_register_driver(struct uart_dri
> * Maybe we should be using a slab cache for this, especially if
> * we have a large number of ports to handle.
> */
> - drv->state = kmalloc(sizeof(struct uart_state) * drv->nr, GFP_KERNEL);
> + drv->state = kzalloc(sizeof(struct uart_state) * drv->nr, GFP_KERNEL);
> retval = -ENOMEM;
> if (!drv->state)
> goto out;
>
> - memset(drv->state, 0, sizeof(struct uart_state) * drv->nr);
> -
> normal = alloc_tty_driver(drv->nr);
> if (!normal)
> goto out;
> diff -rubp linux-2.6.19-rc5_orig/drivers/serial/serial_cs.c linux-2.6.19-rc5_kzalloc/drivers/serial/serial_cs.c
> --- linux-2.6.19-rc5_orig/drivers/serial/serial_cs.c 2006-11-09 12:16:21.000000000 +0200
> +++ linux-2.6.19-rc5_kzalloc/drivers/serial/serial_cs.c 2006-11-11 22:44:04.000000000 +0200
> @@ -334,10 +334,9 @@ static int serial_probe(struct pcmcia_de
> DEBUG(0, "serial_attach()\n");
>
> /* Create new serial device */
> - info = kmalloc(sizeof (*info), GFP_KERNEL);
> + info = kzalloc(sizeof (*info), GFP_KERNEL);
> if (!info)
> return -ENOMEM;
> - memset(info, 0, sizeof (*info));
> info->p_dev = link;
> link->priv = info;
>
The above (and only the above 4 files):
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
prev parent reply other threads:[~2006-11-22 19:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-22 18:57 Burman Yan
2006-11-22 19:12 ` Russell King [this message]
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=20061122191217.GB22601@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=trivial@kernel.org \
--cc=yan_952@hotmail.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
all inboxes | Powered by JetHome®