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>
This commit is contained in:
parent
cff549e486
commit
114fc1d9a8
4 changed files with 7 additions and 12 deletions
|
@ -10437,14 +10437,13 @@ ahd_handle_en_lun(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lstate = kmalloc(sizeof(*lstate), GFP_ATOMIC);
|
lstate = kzalloc(sizeof(*lstate), GFP_ATOMIC);
|
||||||
if (lstate == NULL) {
|
if (lstate == NULL) {
|
||||||
xpt_print_path(ccb->ccb_h.path);
|
xpt_print_path(ccb->ccb_h.path);
|
||||||
printk("Couldn't allocate lstate\n");
|
printk("Couldn't allocate lstate\n");
|
||||||
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
|
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memset(lstate, 0, sizeof(*lstate));
|
|
||||||
status = xpt_create_path(&lstate->path, /*periph*/NULL,
|
status = xpt_create_path(&lstate->path, /*periph*/NULL,
|
||||||
xpt_path_path_id(ccb->ccb_h.path),
|
xpt_path_path_id(ccb->ccb_h.path),
|
||||||
xpt_path_target_id(ccb->ccb_h.path),
|
xpt_path_target_id(ccb->ccb_h.path),
|
||||||
|
|
|
@ -1326,10 +1326,9 @@ int
|
||||||
ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg)
|
ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg)
|
||||||
{
|
{
|
||||||
ahd->platform_data =
|
ahd->platform_data =
|
||||||
kmalloc(sizeof(struct ahd_platform_data), GFP_ATOMIC);
|
kzalloc(sizeof(struct ahd_platform_data), GFP_ATOMIC);
|
||||||
if (ahd->platform_data == NULL)
|
if (ahd->platform_data == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
memset(ahd->platform_data, 0, sizeof(struct ahd_platform_data));
|
|
||||||
ahd->platform_data->irq = AHD_LINUX_NOIRQ;
|
ahd->platform_data->irq = AHD_LINUX_NOIRQ;
|
||||||
ahd_lockinit(ahd);
|
ahd_lockinit(ahd);
|
||||||
ahd->seltime = (aic79xx_seltime & 0x3) << 4;
|
ahd->seltime = (aic79xx_seltime & 0x3) << 4;
|
||||||
|
|
|
@ -4464,10 +4464,9 @@ ahc_softc_init(struct ahc_softc *ahc)
|
||||||
ahc->pause = ahc->unpause | PAUSE;
|
ahc->pause = ahc->unpause | PAUSE;
|
||||||
/* XXX The shared scb data stuff should be deprecated */
|
/* XXX The shared scb data stuff should be deprecated */
|
||||||
if (ahc->scb_data == NULL) {
|
if (ahc->scb_data == NULL) {
|
||||||
ahc->scb_data = kmalloc(sizeof(*ahc->scb_data), GFP_ATOMIC);
|
ahc->scb_data = kzalloc(sizeof(*ahc->scb_data), GFP_ATOMIC);
|
||||||
if (ahc->scb_data == NULL)
|
if (ahc->scb_data == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
memset(ahc->scb_data, 0, sizeof(*ahc->scb_data));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -4780,10 +4779,10 @@ ahc_init_scbdata(struct ahc_softc *ahc)
|
||||||
SLIST_INIT(&scb_data->sg_maps);
|
SLIST_INIT(&scb_data->sg_maps);
|
||||||
|
|
||||||
/* Allocate SCB resources */
|
/* Allocate SCB resources */
|
||||||
scb_data->scbarray = kmalloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC, GFP_ATOMIC);
|
scb_data->scbarray = kzalloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC,
|
||||||
|
GFP_ATOMIC);
|
||||||
if (scb_data->scbarray == NULL)
|
if (scb_data->scbarray == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
memset(scb_data->scbarray, 0, sizeof(struct scb) * AHC_SCB_MAX_ALLOC);
|
|
||||||
|
|
||||||
/* Determine the number of hardware SCBs and initialize them */
|
/* Determine the number of hardware SCBs and initialize them */
|
||||||
|
|
||||||
|
@ -7558,14 +7557,13 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lstate = kmalloc(sizeof(*lstate), GFP_ATOMIC);
|
lstate = kzalloc(sizeof(*lstate), GFP_ATOMIC);
|
||||||
if (lstate == NULL) {
|
if (lstate == NULL) {
|
||||||
xpt_print_path(ccb->ccb_h.path);
|
xpt_print_path(ccb->ccb_h.path);
|
||||||
printk("Couldn't allocate lstate\n");
|
printk("Couldn't allocate lstate\n");
|
||||||
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
|
ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memset(lstate, 0, sizeof(*lstate));
|
|
||||||
status = xpt_create_path(&lstate->path, /*periph*/NULL,
|
status = xpt_create_path(&lstate->path, /*periph*/NULL,
|
||||||
xpt_path_path_id(ccb->ccb_h.path),
|
xpt_path_path_id(ccb->ccb_h.path),
|
||||||
xpt_path_target_id(ccb->ccb_h.path),
|
xpt_path_target_id(ccb->ccb_h.path),
|
||||||
|
|
|
@ -1214,10 +1214,9 @@ ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg)
|
||||||
{
|
{
|
||||||
|
|
||||||
ahc->platform_data =
|
ahc->platform_data =
|
||||||
kmalloc(sizeof(struct ahc_platform_data), GFP_ATOMIC);
|
kzalloc(sizeof(struct ahc_platform_data), GFP_ATOMIC);
|
||||||
if (ahc->platform_data == NULL)
|
if (ahc->platform_data == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
memset(ahc->platform_data, 0, sizeof(struct ahc_platform_data));
|
|
||||||
ahc->platform_data->irq = AHC_LINUX_NOIRQ;
|
ahc->platform_data->irq = AHC_LINUX_NOIRQ;
|
||||||
ahc_lockinit(ahc);
|
ahc_lockinit(ahc);
|
||||||
ahc->seltime = (aic7xxx_seltime & 0x3) << 4;
|
ahc->seltime = (aic7xxx_seltime & 0x3) << 4;
|
||||||
|
|
Loading…
Add table
Reference in a new issue