Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1526177 > unrolled thread

[PATCH v2] ufs: qcom: Properly clear hba priv on failure

Started byBjorn Andersson <bjorn.andersson@linaro.org>
First post2016-11-20 07:40 +0100
Last post2016-11-22 04:50 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] ufs: qcom: Properly clear hba priv on failure Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-11-20 07:40 +0100
    Re: [PATCH v2] ufs: qcom: Properly clear hba priv on failure Subhash Jadavani <subhashj@codeaurora.org> - 2016-11-21 19:40 +0100
    Re: [PATCH v2] ufs: qcom: Properly clear hba priv on failure "Martin K. Petersen" <martin.petersen@oracle.com> - 2016-11-22 04:50 +0100

#1526177 — [PATCH v2] ufs: qcom: Properly clear hba priv on failure

FromBjorn Andersson <bjorn.andersson@linaro.org>
Date2016-11-20 07:40 +0100
Subject[PATCH v2] ufs: qcom: Properly clear hba priv on failure
Message-ID<sFtXb-7tr-13@gated-at.bofh.it>
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>
---
 drivers/scsi/ufs/ufs-qcom.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index d345434b084f..4de372d271b0 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/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)) {
 		err = PTR_ERR(host->generic_phy);
 		dev_err(dev, "%s: PHY get failed %d\n", __func__, err);
-		goto out;
+		goto out_variant_clear;
 	}
 
 	err = ufs_qcom_bus_register(host);
 	if (err)
-		goto out_host_free;
+		goto out_variant_clear;
 
 	ufs_qcom_get_controller_revision(hba, &host->hw_ver.major,
 		&host->hw_ver.minor, &host->hw_ver.step);
@@ -1267,7 +1267,7 @@ static int ufs_qcom_init(struct ufs_hba *hba)
 	phy_power_off(host->generic_phy);
 out_unregister_bus:
 	phy_exit(host->generic_phy);
-out_host_free:
+out_variant_clear:
 	ufshcd_set_variant(hba, NULL);
 out:
 	return err;
-- 
2.5.0

[toc] | [next] | [standalone]


#1526971

FromSubhash Jadavani <subhashj@codeaurora.org>
Date2016-11-21 19:40 +0100
Message-ID<sG1Fw-4P0-25@gated-at.bofh.it>
In reply to#1526177
On 2016-11-19 22:34, Bjorn Andersson wrote:
> 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>
> ---
>  drivers/scsi/ufs/ufs-qcom.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index d345434b084f..4de372d271b0 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/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)) {
>  		err = PTR_ERR(host->generic_phy);
>  		dev_err(dev, "%s: PHY get failed %d\n", __func__, err);
> -		goto out;
> +		goto out_variant_clear;
>  	}
> 
>  	err = ufs_qcom_bus_register(host);
>  	if (err)
> -		goto out_host_free;
> +		goto out_variant_clear;
> 
>  	ufs_qcom_get_controller_revision(hba, &host->hw_ver.major,
>  		&host->hw_ver.minor, &host->hw_ver.step);
> @@ -1267,7 +1267,7 @@ static int ufs_qcom_init(struct ufs_hba *hba)
>  	phy_power_off(host->generic_phy);
>  out_unregister_bus:
>  	phy_exit(host->generic_phy);
> -out_host_free:
> +out_variant_clear:
>  	ufshcd_set_variant(hba, NULL);
>  out:
>  	return err;

Looks good to me.
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [next] | [standalone]


#1527203

From"Martin K. Petersen" <martin.petersen@oracle.com>
Date2016-11-22 04:50 +0100
Message-ID<sGafM-1Ox-9@gated-at.bofh.it>
In reply to#1526177
>>>>> "Bjorn" == Bjorn Andersson <bjorn.andersson@linaro.org> writes:

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

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web