Skip to content

Commit

Permalink
scsi: lpfc: Use kcalloc()
Browse files Browse the repository at this point in the history
Use kcalloc() instead of kmalloc() + memset().

Link: https://lore.kernel.org/r/20220313141847.109804-1-Julia.Lawall@inria.fr
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
JuliaLawall authored and martinkpetersen committed Mar 15, 2022
1 parent 9d05790 commit dc26464
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/scsi/lpfc/lpfc_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6272,9 +6272,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
phba->hba_debugfs_root,
phba, &lpfc_debugfs_op_slow_ring_trc);
if (!phba->slow_ring_trc) {
phba->slow_ring_trc = kmalloc(
(sizeof(struct lpfc_debugfs_trc) *
lpfc_debugfs_max_slow_ring_trc),
phba->slow_ring_trc = kcalloc(
lpfc_debugfs_max_slow_ring_trc,
sizeof(struct lpfc_debugfs_trc),
GFP_KERNEL);
if (!phba->slow_ring_trc) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
Expand All @@ -6283,9 +6283,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
goto debug_failed;
}
atomic_set(&phba->slow_ring_trc_cnt, 0);
memset(phba->slow_ring_trc, 0,
(sizeof(struct lpfc_debugfs_trc) *
lpfc_debugfs_max_slow_ring_trc));
}

snprintf(name, sizeof(name), "nvmeio_trc");
Expand Down

0 comments on commit dc26464

Please sign in to comment.