summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi/be_main.c
diff options
context:
space:
mode:
authorHimanshu Jha <himanshujha199640@gmail.com>2017-10-11 17:36:14 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2017-11-07 04:58:02 +0100
commitd38c9a803b42d19d125aff586dfaac77b5702d05 (patch)
treebfab3a8866099e7af1159f0ee9f6f36a7c2a3db6 /drivers/scsi/be2iscsi/be_main.c
parentscsi: storvsc: Avoid excessive host scan on controller change (diff)
downloadlinux-d38c9a803b42d19d125aff586dfaac77b5702d05.tar.xz
linux-d38c9a803b42d19d125aff586dfaac77b5702d05.zip
scsi: be2iscsi: Use kasprintf
Use kasprintf instead of combination of kmalloc and sprintf. Also, remove BEISCSI_MSI_NAME macro used to specify size of string as kasprintf handles size computations. Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com> Reviewed-by: Kyle Fortin <kyle.fortin@oracle.com> Reviewed-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/be2iscsi/be_main.c')
-rw-r--r--drivers/scsi/be2iscsi/be_main.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 7561e1332257..1db21b657800 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -818,15 +818,14 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
if (pcidev->msix_enabled) {
for (i = 0; i < phba->num_cpus; i++) {
- phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME,
- GFP_KERNEL);
+ phba->msi_name[i] = kasprintf(GFP_KERNEL,
+ "beiscsi_%02x_%02x",
+ phba->shost->host_no, i);
if (!phba->msi_name[i]) {
ret = -ENOMEM;
goto free_msix_irqs;
}
- sprintf(phba->msi_name[i], "beiscsi_%02x_%02x",
- phba->shost->host_no, i);
ret = request_irq(pci_irq_vector(pcidev, i),
be_isr_msix, 0, phba->msi_name[i],
&phwi_context->be_eq[i]);
@@ -839,13 +838,12 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba)
goto free_msix_irqs;
}
}
- phba->msi_name[i] = kzalloc(BEISCSI_MSI_NAME, GFP_KERNEL);
+ phba->msi_name[i] = kasprintf(GFP_KERNEL, "beiscsi_mcc_%02x",
+ phba->shost->host_no);
if (!phba->msi_name[i]) {
ret = -ENOMEM;
goto free_msix_irqs;
}
- sprintf(phba->msi_name[i], "beiscsi_mcc_%02x",
- phba->shost->host_no);
ret = request_irq(pci_irq_vector(pcidev, i), be_isr_mcc, 0,
phba->msi_name[i], &phwi_context->be_eq[i]);
if (ret) {