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

aic7xxx: replace kmalloc/memset by kzalloc

This replaces kmalloc + memset by a call to kzalloc

This also fixes one checkpatch.pl issue in the process.

This improvement was suggested by "make coccicheck"

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Michael Opdenacker and committed by
James Bottomley
114fc1d9 cff549e4

+7 -12
+1 -2
drivers/scsi/aic7xxx/aic79xx_core.c
··· 10437 10437 return; 10438 10438 } 10439 10439 } 10440 - lstate = kmalloc(sizeof(*lstate), GFP_ATOMIC); 10440 + lstate = kzalloc(sizeof(*lstate), GFP_ATOMIC); 10441 10441 if (lstate == NULL) { 10442 10442 xpt_print_path(ccb->ccb_h.path); 10443 10443 printk("Couldn't allocate lstate\n"); 10444 10444 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; 10445 10445 return; 10446 10446 } 10447 - memset(lstate, 0, sizeof(*lstate)); 10448 10447 status = xpt_create_path(&lstate->path, /*periph*/NULL, 10449 10448 xpt_path_path_id(ccb->ccb_h.path), 10450 10449 xpt_path_target_id(ccb->ccb_h.path),
+1 -2
drivers/scsi/aic7xxx/aic79xx_osm.c
··· 1326 1326 ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg) 1327 1327 { 1328 1328 ahd->platform_data = 1329 - kmalloc(sizeof(struct ahd_platform_data), GFP_ATOMIC); 1329 + kzalloc(sizeof(struct ahd_platform_data), GFP_ATOMIC); 1330 1330 if (ahd->platform_data == NULL) 1331 1331 return (ENOMEM); 1332 - memset(ahd->platform_data, 0, sizeof(struct ahd_platform_data)); 1333 1332 ahd->platform_data->irq = AHD_LINUX_NOIRQ; 1334 1333 ahd_lockinit(ahd); 1335 1334 ahd->seltime = (aic79xx_seltime & 0x3) << 4;
+4 -6
drivers/scsi/aic7xxx/aic7xxx_core.c
··· 4464 4464 ahc->pause = ahc->unpause | PAUSE; 4465 4465 /* XXX The shared scb data stuff should be deprecated */ 4466 4466 if (ahc->scb_data == NULL) { 4467 - ahc->scb_data = kmalloc(sizeof(*ahc->scb_data), GFP_ATOMIC); 4467 + ahc->scb_data = kzalloc(sizeof(*ahc->scb_data), GFP_ATOMIC); 4468 4468 if (ahc->scb_data == NULL) 4469 4469 return (ENOMEM); 4470 - memset(ahc->scb_data, 0, sizeof(*ahc->scb_data)); 4471 4470 } 4472 4471 4473 4472 return (0); ··· 4779 4780 SLIST_INIT(&scb_data->sg_maps); 4780 4781 4781 4782 /* Allocate SCB resources */ 4782 - scb_data->scbarray = kmalloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC, GFP_ATOMIC); 4783 + scb_data->scbarray = kzalloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC, 4784 + GFP_ATOMIC); 4783 4785 if (scb_data->scbarray == NULL) 4784 4786 return (ENOMEM); 4785 - memset(scb_data->scbarray, 0, sizeof(struct scb) * AHC_SCB_MAX_ALLOC); 4786 4787 4787 4788 /* Determine the number of hardware SCBs and initialize them */ 4788 4789 ··· 7557 7558 return; 7558 7559 } 7559 7560 } 7560 - lstate = kmalloc(sizeof(*lstate), GFP_ATOMIC); 7561 + lstate = kzalloc(sizeof(*lstate), GFP_ATOMIC); 7561 7562 if (lstate == NULL) { 7562 7563 xpt_print_path(ccb->ccb_h.path); 7563 7564 printk("Couldn't allocate lstate\n"); 7564 7565 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; 7565 7566 return; 7566 7567 } 7567 - memset(lstate, 0, sizeof(*lstate)); 7568 7568 status = xpt_create_path(&lstate->path, /*periph*/NULL, 7569 7569 xpt_path_path_id(ccb->ccb_h.path), 7570 7570 xpt_path_target_id(ccb->ccb_h.path),
+1 -2
drivers/scsi/aic7xxx/aic7xxx_osm.c
··· 1214 1214 { 1215 1215 1216 1216 ahc->platform_data = 1217 - kmalloc(sizeof(struct ahc_platform_data), GFP_ATOMIC); 1217 + kzalloc(sizeof(struct ahc_platform_data), GFP_ATOMIC); 1218 1218 if (ahc->platform_data == NULL) 1219 1219 return (ENOMEM); 1220 - memset(ahc->platform_data, 0, sizeof(struct ahc_platform_data)); 1221 1220 ahc->platform_data->irq = AHC_LINUX_NOIRQ; 1222 1221 ahc_lockinit(ahc); 1223 1222 ahc->seltime = (aic7xxx_seltime & 0x3) << 4;