From c2825345ea65ee89277f7a276a4b8a6b703a812a Mon Sep 17 00:00:00 2001 From: Can Guo Date: Wed, 10 Jun 2020 11:12:23 +0800 Subject: [PATCH] scsi: ufs-qcom: Remove unnecessary devm_kfree Resources allocated with devm_* are managed by device driver framework, meaning the resources will be automatically released when the associated device is removed. Besides, having a devm_kfree here would cause a use-after-free scenario: after hba->host is freed up, data inside hba->host shall still be accessed when device driver framework frees up all resources associated with hba->dev. hba->host->rcdev, for example, shall be used by func devm_reset_controller_release() when resources associated with hba->dev are freed up. Change-Id: I90bab41c34450a1c814d863b9f3653228f5eeb95 Signed-off-by: Can Guo --- drivers/scsi/ufs/ufs-qcom.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 62a812c1450d..5b79951bf450 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -2311,7 +2311,6 @@ out_disable_vddp: out_phy_exit: phy_exit(host->generic_phy); out_variant_clear: - devm_kfree(dev, host); ufshcd_set_variant(hba, NULL); out: return err;