Browse Source

scsi: ufs: qcom: Properly clear hba priv on failure

ufs_qcom_init() sets the hba priv data before attempting to acquire the
phy handle, so make sure to clear this in the case of an error. Failing
to do this will make ufs_qcom_setup_clocks() operate on the uninitalized
host object.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bjorn Andersson 8 years ago
parent
commit
a6854dff63
1 changed files with 3 additions and 3 deletions
  1. 3 3
      drivers/scsi/ufs/ufs-qcom.c

+ 3 - 3
drivers/scsi/ufs/ufs-qcom.c

@@ -1197,12 +1197,12 @@ static int ufs_qcom_init(struct ufs_hba *hba)
 	if (IS_ERR(host->generic_phy)) {
 	if (IS_ERR(host->generic_phy)) {
 		err = PTR_ERR(host->generic_phy);
 		err = PTR_ERR(host->generic_phy);
 		dev_err(dev, "%s: PHY get failed %d\n", __func__, err);
 		dev_err(dev, "%s: PHY get failed %d\n", __func__, err);
-		goto out;
+		goto out_variant_clear;
 	}
 	}
 
 
 	err = ufs_qcom_bus_register(host);
 	err = ufs_qcom_bus_register(host);
 	if (err)
 	if (err)
-		goto out_host_free;
+		goto out_variant_clear;
 
 
 	ufs_qcom_get_controller_revision(hba, &host->hw_ver.major,
 	ufs_qcom_get_controller_revision(hba, &host->hw_ver.major,
 		&host->hw_ver.minor, &host->hw_ver.step);
 		&host->hw_ver.minor, &host->hw_ver.step);
@@ -1267,7 +1267,7 @@ out_disable_phy:
 	phy_power_off(host->generic_phy);
 	phy_power_off(host->generic_phy);
 out_unregister_bus:
 out_unregister_bus:
 	phy_exit(host->generic_phy);
 	phy_exit(host->generic_phy);
-out_host_free:
+out_variant_clear:
 	ufshcd_set_variant(hba, NULL);
 	ufshcd_set_variant(hba, NULL);
 out:
 out:
 	return err;
 	return err;