Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] ub: use kzalloc

Switch from kmalloc+memset to kzalloc.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Pete Zaitcev and committed by
Greg Kroah-Hartman
29da7937 9ee884cc

+4 -8
+4 -8
drivers/block/ub.c
··· 2007 2007 init_completion(&compl); 2008 2008 2009 2009 rc = -ENOMEM; 2010 - if ((cmd = kmalloc(ALLOC_SIZE, GFP_KERNEL)) == NULL) 2010 + if ((cmd = kzalloc(ALLOC_SIZE, GFP_KERNEL)) == NULL) 2011 2011 goto err_alloc; 2012 - memset(cmd, 0, ALLOC_SIZE); 2013 2012 2014 2013 cmd->cdb[0] = TEST_UNIT_READY; 2015 2014 cmd->cdb_len = 6; ··· 2061 2062 init_completion(&compl); 2062 2063 2063 2064 rc = -ENOMEM; 2064 - if ((cmd = kmalloc(ALLOC_SIZE, GFP_KERNEL)) == NULL) 2065 + if ((cmd = kzalloc(ALLOC_SIZE, GFP_KERNEL)) == NULL) 2065 2066 goto err_alloc; 2066 - memset(cmd, 0, ALLOC_SIZE); 2067 2067 p = (char *)cmd + sizeof(struct ub_scsi_cmd); 2068 2068 2069 2069 cmd->cdb[0] = 0x25; ··· 2403 2405 return -ENXIO; 2404 2406 2405 2407 rc = -ENOMEM; 2406 - if ((sc = kmalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL) 2408 + if ((sc = kzalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL) 2407 2409 goto err_core; 2408 - memset(sc, 0, sizeof(struct ub_dev)); 2409 2410 sc->lock = ub_next_lock(); 2410 2411 INIT_LIST_HEAD(&sc->luns); 2411 2412 usb_init_urb(&sc->work_urb); ··· 2521 2524 int rc; 2522 2525 2523 2526 rc = -ENOMEM; 2524 - if ((lun = kmalloc(sizeof(struct ub_lun), GFP_KERNEL)) == NULL) 2527 + if ((lun = kzalloc(sizeof(struct ub_lun), GFP_KERNEL)) == NULL) 2525 2528 goto err_alloc; 2526 - memset(lun, 0, sizeof(struct ub_lun)); 2527 2529 lun->num = lnum; 2528 2530 2529 2531 rc = -ENOSR;