[PATCH] serial: replace kmalloc+memset with kzalloc

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Burman Yan
2007-02-14 00:33:07 -08:00
committed by Linus Torvalds
parent 3689a0ec60
commit 8f31bb39ec
10 changed files with 18 additions and 45 deletions

View File

@ -1523,9 +1523,8 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
}
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);
@ -2178,13 +2177,11 @@ int uart_register_driver(struct uart_driver *drv)
* 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;