summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2017-01-22 16:17:47 -0500
committerKishon Vijay Abraham I <kishon@ti.com>2017-01-27 02:36:52 -0500
commit3471426f6ddb341debb0fc500ea9b4bb5f3f74ec (patch)
tree3fd7955e1a774262a4c24b5b8b0f30f18c50576e /drivers
parente7d5e412160c2143de1f818668774b33b3cdab0b (diff)
phy: qcom-ufs: Correct usage of regulator_get()
When regulator_get() tries to resolve a regulator supply but fail to find a matching property in DeviceTree it returns a dummy regulator, if a matching supply is specified but unavailable the regulator core will return an error. Based on this we should not ignore errors upon failing to acquire the optional "vddp-ref-clk" supply. Reviewed-by: Vivek Gautam <vivek.gautam@codeaurora.org> Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/phy/phy-qcom-ufs.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c
index 4d7f3c018223..bbd317158084 100644
--- a/drivers/phy/phy-qcom-ufs.c
+++ b/drivers/phy/phy-qcom-ufs.c
@@ -210,8 +210,9 @@ out:
210} 210}
211EXPORT_SYMBOL_GPL(ufs_qcom_phy_init_clks); 211EXPORT_SYMBOL_GPL(ufs_qcom_phy_init_clks);
212 212
213static int __ufs_qcom_phy_init_vreg(struct device *dev, 213static int ufs_qcom_phy_init_vreg(struct device *dev,
214 struct ufs_qcom_phy_vreg *vreg, const char *name, bool optional) 214 struct ufs_qcom_phy_vreg *vreg,
215 const char *name)
215{ 216{
216 int err = 0; 217 int err = 0;
217 218
@@ -221,9 +222,7 @@ static int __ufs_qcom_phy_init_vreg(struct device *dev,
221 vreg->reg = devm_regulator_get(dev, name); 222 vreg->reg = devm_regulator_get(dev, name);
222 if (IS_ERR(vreg->reg)) { 223 if (IS_ERR(vreg->reg)) {
223 err = PTR_ERR(vreg->reg); 224 err = PTR_ERR(vreg->reg);
224 vreg->reg = NULL; 225 dev_err(dev, "failed to get %s, %d\n", name, err);
225 if (!optional)
226 dev_err(dev, "failed to get %s, %d\n", name, err);
227 goto out; 226 goto out;
228 } 227 }
229 228
@@ -263,12 +262,6 @@ out:
263 return err; 262 return err;
264} 263}
265 264
266static int ufs_qcom_phy_init_vreg(struct device *dev,
267 struct ufs_qcom_phy_vreg *vreg, const char *name)
268{
269 return __ufs_qcom_phy_init_vreg(dev, vreg, name, false);
270}
271
272int ufs_qcom_phy_init_vregulators(struct ufs_qcom_phy *phy_common) 265int ufs_qcom_phy_init_vregulators(struct ufs_qcom_phy *phy_common)
273{ 266{
274 int err; 267 int err;
@@ -284,9 +277,9 @@ int ufs_qcom_phy_init_vregulators(struct ufs_qcom_phy *phy_common)
284 if (err) 277 if (err)
285 goto out; 278 goto out;
286 279
287 /* vddp-ref-clk-* properties are optional */ 280 err = ufs_qcom_phy_init_vreg(phy_common->dev, &phy_common->vddp_ref_clk,
288 __ufs_qcom_phy_init_vreg(phy_common->dev, &phy_common->vddp_ref_clk, 281 "vddp-ref-clk");
289 "vddp-ref-clk", true); 282
290out: 283out:
291 return err; 284 return err;
292} 285}