summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorVasyl Gomonovych <gomonovych@gmail.com>2017-10-11 21:42:41 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2017-11-03 12:26:09 -0400
commit1c356ec5e932c8d4c83d9782ab3c4164b6471d5d (patch)
treeb811b4e5c017aacda748f022856917fc132eb218 /drivers/scsi
parent62d2f77438873d366807e0db81bd05a8bab566d8 (diff)
downloadlinux-1c356ec5e932c8d4c83d9782ab3c4164b6471d5d.tar.gz
linux-1c356ec5e932c8d4c83d9782ab3c4164b6471d5d.tar.bz2
linux-1c356ec5e932c8d4c83d9782ab3c4164b6471d5d.zip
scsi: lpfc: fix kzalloc-simple.cocci warnings
drivers/scsi/lpfc/lpfc_debugfs.c:5460:22-29: WARNING: kzalloc should be used for phba -> nvmeio_trc, instead of kmalloc/memset drivers/scsi/lpfc/lpfc_debugfs.c:2230:20-27: WARNING: kzalloc should be used for phba -> nvmeio_trc, instead of kmalloc/memset Use kzalloc rather than kmalloc followed by memset with 0 Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com> Acked-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index d50c481ec41c..2bf5ad3b1512 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -2227,7 +2227,7 @@ lpfc_debugfs_nvmeio_trc_write(struct file *file, const char __user *buf,
kfree(phba->nvmeio_trc);
/* Allocate new trace buffer and initialize */
- phba->nvmeio_trc = kmalloc((sizeof(struct lpfc_debugfs_nvmeio_trc) *
+ phba->nvmeio_trc = kzalloc((sizeof(struct lpfc_debugfs_nvmeio_trc) *
sz), GFP_KERNEL);
if (!phba->nvmeio_trc) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
@@ -2235,8 +2235,6 @@ lpfc_debugfs_nvmeio_trc_write(struct file *file, const char __user *buf,
"nvmeio_trc buffer\n");
return -ENOMEM;
}
- memset(phba->nvmeio_trc, 0,
- (sizeof(struct lpfc_debugfs_nvmeio_trc) * sz));
atomic_set(&phba->nvmeio_trc_cnt, 0);
phba->nvmeio_trc_on = 0;
phba->nvmeio_trc_output_idx = 0;
@@ -5457,7 +5455,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
phba->nvmeio_trc_size = lpfc_debugfs_max_nvmeio_trc;
/* Allocate trace buffer and initialize */
- phba->nvmeio_trc = kmalloc(
+ phba->nvmeio_trc = kzalloc(
(sizeof(struct lpfc_debugfs_nvmeio_trc) *
phba->nvmeio_trc_size), GFP_KERNEL);
@@ -5467,9 +5465,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
"nvmeio_trc buffer\n");
goto nvmeio_off;
}
- memset(phba->nvmeio_trc, 0,
- (sizeof(struct lpfc_debugfs_nvmeio_trc) *
- phba->nvmeio_trc_size));
phba->nvmeio_trc_on = 1;
phba->nvmeio_trc_output_idx = 0;
phba->nvmeio_trc = NULL;