summaryrefslogtreecommitdiff
path: root/drivers/scsi/mvsas
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2017-08-08 15:02:51 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2017-08-11 02:55:35 +0300
commitcf99dc30bcc56c33243b5bbfef9d8ea943dd2e1c (patch)
treeae11586a011e821c72fbc85a8f4ff59877aafbd0 /drivers/scsi/mvsas
parentbc1371c181b503fe925ae292cd96618f305790cd (diff)
downloadlinux-cf99dc30bcc56c33243b5bbfef9d8ea943dd2e1c.tar.xz
scsi: mvsas: replace kfree with scsi_host_put
The return value of scsi_host_alloc() should be released by scsi_host_put(). However, in function mvs_pci_init(), kfree() is used. This patch replaces kfree() with scsi_host_put() to avoid possible memory leaks. Signed-off-by: Pan Bian <bianpan2016@163.com> Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/mvsas')
-rw-r--r--drivers/scsi/mvsas/mv_init.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index 1d53410334cc..f0a096a1e276 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -557,14 +557,14 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent)
SHOST_TO_SAS_HA(shost) =
kcalloc(1, sizeof(struct sas_ha_struct), GFP_KERNEL);
if (!SHOST_TO_SAS_HA(shost)) {
- kfree(shost);
+ scsi_host_put(shost);
rc = -ENOMEM;
goto err_out_regions;
}
rc = mvs_prep_sas_ha_init(shost, chip);
if (rc) {
- kfree(shost);
+ scsi_host_put(shost);
rc = -ENOMEM;
goto err_out_regions;
}