Skip to content

Commit 114fc1d

Browse files
Michael OpdenackerJames Bottomley
Michael Opdenacker
authored and
James Bottomley
committed
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 <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent cff549e commit 114fc1d

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

Diff for: drivers/scsi/aic7xxx/aic79xx_core.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -10437,14 +10437,13 @@ ahd_handle_en_lun(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb)
1043710437
return;
1043810438
}
1043910439
}
10440-
lstate = kmalloc(sizeof(*lstate), GFP_ATOMIC);
10440+
lstate = kzalloc(sizeof(*lstate), GFP_ATOMIC);
1044110441
if (lstate == NULL) {
1044210442
xpt_print_path(ccb->ccb_h.path);
1044310443
printk("Couldn't allocate lstate\n");
1044410444
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
1044510445
return;
1044610446
}
10447-
memset(lstate, 0, sizeof(*lstate));
1044810447
status = xpt_create_path(&lstate->path, /*periph*/NULL,
1044910448
xpt_path_path_id(ccb->ccb_h.path),
1045010449
xpt_path_target_id(ccb->ccb_h.path),

Diff for: drivers/scsi/aic7xxx/aic79xx_osm.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1326,10 +1326,9 @@ int
13261326
ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg)
13271327
{
13281328
ahd->platform_data =
1329-
kmalloc(sizeof(struct ahd_platform_data), GFP_ATOMIC);
1329+
kzalloc(sizeof(struct ahd_platform_data), GFP_ATOMIC);
13301330
if (ahd->platform_data == NULL)
13311331
return (ENOMEM);
1332-
memset(ahd->platform_data, 0, sizeof(struct ahd_platform_data));
13331332
ahd->platform_data->irq = AHD_LINUX_NOIRQ;
13341333
ahd_lockinit(ahd);
13351334
ahd->seltime = (aic79xx_seltime & 0x3) << 4;

Diff for: drivers/scsi/aic7xxx/aic7xxx_core.c

+4-6
Original file line numberDiff line numberDiff line change
@@ -4464,10 +4464,9 @@ ahc_softc_init(struct ahc_softc *ahc)
44644464
ahc->pause = ahc->unpause | PAUSE;
44654465
/* XXX The shared scb data stuff should be deprecated */
44664466
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);
44684468
if (ahc->scb_data == NULL)
44694469
return (ENOMEM);
4470-
memset(ahc->scb_data, 0, sizeof(*ahc->scb_data));
44714470
}
44724471

44734472
return (0);
@@ -4780,10 +4779,10 @@ ahc_init_scbdata(struct ahc_softc *ahc)
47804779
SLIST_INIT(&scb_data->sg_maps);
47814780

47824781
/* 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);
47844784
if (scb_data->scbarray == NULL)
47854785
return (ENOMEM);
4786-
memset(scb_data->scbarray, 0, sizeof(struct scb) * AHC_SCB_MAX_ALLOC);
47874786

47884787
/* Determine the number of hardware SCBs and initialize them */
47894788

@@ -7558,14 +7557,13 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb)
75587557
return;
75597558
}
75607559
}
7561-
lstate = kmalloc(sizeof(*lstate), GFP_ATOMIC);
7560+
lstate = kzalloc(sizeof(*lstate), GFP_ATOMIC);
75627561
if (lstate == NULL) {
75637562
xpt_print_path(ccb->ccb_h.path);
75647563
printk("Couldn't allocate lstate\n");
75657564
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
75667565
return;
75677566
}
7568-
memset(lstate, 0, sizeof(*lstate));
75697567
status = xpt_create_path(&lstate->path, /*periph*/NULL,
75707568
xpt_path_path_id(ccb->ccb_h.path),
75717569
xpt_path_target_id(ccb->ccb_h.path),

Diff for: drivers/scsi/aic7xxx/aic7xxx_osm.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1214,10 +1214,9 @@ ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg)
12141214
{
12151215

12161216
ahc->platform_data =
1217-
kmalloc(sizeof(struct ahc_platform_data), GFP_ATOMIC);
1217+
kzalloc(sizeof(struct ahc_platform_data), GFP_ATOMIC);
12181218
if (ahc->platform_data == NULL)
12191219
return (ENOMEM);
1220-
memset(ahc->platform_data, 0, sizeof(struct ahc_platform_data));
12211220
ahc->platform_data->irq = AHC_LINUX_NOIRQ;
12221221
ahc_lockinit(ahc);
12231222
ahc->seltime = (aic7xxx_seltime & 0x3) << 4;

0 commit comments

Comments
 (0)