aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Opdenacker <michael.opdenacker@free-electrons.com>2015-03-26 20:51:46 -0400
committerJames Bottomley <JBottomley@Odin.com>2015-04-09 16:22:10 -0400
commit114fc1d9a8cc7e8eb34fb3896d908992dac09b58 (patch)
tree3af8f970f587243b8f3bd180b2b56cd4ce71d5d9
parentcff549e4860fcdea6b22510defdc8c8a0f82455a (diff)
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>
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_core.c3
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c3
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c10
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c3
4 files changed, 7 insertions, 12 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 97f2accd3dbb..109e2c99e6c1 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -10437,14 +10437,13 @@ ahd_handle_en_lun(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb)
10437 return; 10437 return;
10438 } 10438 }
10439 } 10439 }
10440 lstate = kmalloc(sizeof(*lstate), GFP_ATOMIC); 10440 lstate = kzalloc(sizeof(*lstate), GFP_ATOMIC);
10441 if (lstate == NULL) { 10441 if (lstate == NULL) {
10442 xpt_print_path(ccb->ccb_h.path); 10442 xpt_print_path(ccb->ccb_h.path);
10443 printk("Couldn't allocate lstate\n"); 10443 printk("Couldn't allocate lstate\n");
10444 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; 10444 ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
10445 return; 10445 return;
10446 } 10446 }
10447 memset(lstate, 0, sizeof(*lstate));
10448 status = xpt_create_path(&lstate->path, /*periph*/NULL, 10447 status = xpt_create_path(&lstate->path, /*periph*/NULL,
10449 xpt_path_path_id(ccb->ccb_h.path), 10448 xpt_path_path_id(ccb->ccb_h.path),
10450 xpt_path_target_id(ccb->ccb_h.path), 10449 xpt_path_target_id(ccb->ccb_h.path),
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index d5c7b193d8d3..ce96a0be3282 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1326,10 +1326,9 @@ int
1326ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg) 1326ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg)
1327{ 1327{
1328 ahd->platform_data = 1328 ahd->platform_data =
1329 kmalloc(sizeof(struct ahd_platform_data), GFP_ATOMIC); 1329 kzalloc(sizeof(struct ahd_platform_data), GFP_ATOMIC);
1330 if (ahd->platform_data == NULL) 1330 if (ahd->platform_data == NULL)
1331 return (ENOMEM); 1331 return (ENOMEM);
1332 memset(ahd->platform_data, 0, sizeof(struct ahd_platform_data));
1333 ahd->platform_data->irq = AHD_LINUX_NOIRQ; 1332 ahd->platform_data->irq = AHD_LINUX_NOIRQ;
1334 ahd_lockinit(ahd); 1333 ahd_lockinit(ahd);
1335 ahd->seltime = (aic79xx_seltime & 0x3) << 4; 1334 ahd->seltime = (aic79xx_seltime & 0x3) << 4;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index 10172a3af1b9..c4829d84b335 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -4464,10 +4464,9 @@ ahc_softc_init(struct ahc_softc *ahc)
4464 ahc->pause = ahc->unpause | PAUSE; 4464 ahc->pause = ahc->unpause | PAUSE;
4465 /* XXX The shared scb data stuff should be deprecated */ 4465 /* XXX The shared scb data stuff should be deprecated */
4466 if (ahc->scb_data == NULL) { 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 if (ahc->scb_data == NULL) 4468 if (ahc->scb_data == NULL)
4469 return (ENOMEM); 4469 return (ENOMEM);
4470 memset(ahc->scb_data, 0, sizeof(*ahc->scb_data));
4471 } 4470 }
4472 4471
4473 return (0); 4472 return (0);
@@ -4780,10 +4779,10 @@ ahc_init_scbdata(struct ahc_softc *ahc)
4780 SLIST_INIT(&scb_data->sg_maps); 4779 SLIST_INIT(&scb_data->sg_maps);
4781 4780
4782 /* Allocate SCB resources */ 4781 /* Allocate SCB resources */
4783 scb_data->scbarray = kmalloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC, GFP_ATOMIC); 4782 scb_data->scbarray = kzalloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC,
4783 GFP_ATOMIC);
4784 if (scb_data->scbarray == NULL) 4784 if (scb_data->scbarray == NULL)
4785 return (ENOMEM); 4785 return (ENOMEM);
4786 memset(scb_data->scbarray, 0, sizeof(struct scb) * AHC_SCB_MAX_ALLOC);
4787 4786
4788 /* Determine the number of hardware SCBs and initialize them */ 4787 /* Determine the number of hardware SCBs and initialize them */
4789 4788
@@ -7558,14 +7557,13 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb)
7558 return; 7557 return;
7559 } 7558 }
7560 } 7559 }
7561 lstate = kmalloc(sizeof(*lstate), GFP_ATOMIC); 7560 lstate = kzalloc(sizeof(*lstate), GFP_ATOMIC);
7562 if (lstate == NULL) { 7561 if (lstate == NULL) {
7563 xpt_print_path(ccb->ccb_h.path); 7562 xpt_print_path(ccb->ccb_h.path);
7564 printk("Couldn't allocate lstate\n"); 7563 printk("Couldn't allocate lstate\n");
7565 ccb->ccb_h.status = CAM_RESRC_UNAVAIL; 7564 ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
7566 return; 7565 return;
7567 } 7566 }
7568 memset(lstate, 0, sizeof(*lstate));
7569 status = xpt_create_path(&lstate->path, /*periph*/NULL, 7567 status = xpt_create_path(&lstate->path, /*periph*/NULL,
7570 xpt_path_path_id(ccb->ccb_h.path), 7568 xpt_path_path_id(ccb->ccb_h.path),
7571 xpt_path_target_id(ccb->ccb_h.path), 7569 xpt_path_target_id(ccb->ccb_h.path),
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 88360116dbcb..a2f2c774cd6b 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1214,10 +1214,9 @@ ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg)
1214{ 1214{
1215 1215
1216 ahc->platform_data = 1216 ahc->platform_data =
1217 kmalloc(sizeof(struct ahc_platform_data), GFP_ATOMIC); 1217 kzalloc(sizeof(struct ahc_platform_data), GFP_ATOMIC);
1218 if (ahc->platform_data == NULL) 1218 if (ahc->platform_data == NULL)
1219 return (ENOMEM); 1219 return (ENOMEM);
1220 memset(ahc->platform_data, 0, sizeof(struct ahc_platform_data));
1221 ahc->platform_data->irq = AHC_LINUX_NOIRQ; 1220 ahc->platform_data->irq = AHC_LINUX_NOIRQ;
1222 ahc_lockinit(ahc); 1221 ahc_lockinit(ahc);
1223 ahc->seltime = (aic7xxx_seltime & 0x3) << 4; 1222 ahc->seltime = (aic7xxx_seltime & 0x3) << 4;