From: Pan Bian Date: Tue, 8 Aug 2017 12:02:51 +0000 (+0800) Subject: scsi: mvsas: replace kfree with scsi_host_put X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cf99dc30bcc56c33243b5bbfef9d8ea943dd2e1c;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Reviewed-by: Jack Wang Signed-off-by: Martin K. Petersen --- 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; }