Commit d6c925ca authored by Vaishali Thakkar's avatar Vaishali Thakkar Committed by Rob Clark

drm/msm: Move call to PTR_ERR_OR_ZERO after reassignment

Here, a location is reset to NULL before being passed to PTR_ERR.
So, PTR_ERR should be called before its argument is reassigned
to NULL. Further to simplify things use PTR_ERR_OR_ZERO instead
of PTR_ERR and IS_ERR.

Problem found using Coccinelle.
Signed-off-by: default avatarVaishali Thakkar <vaishali.thakkar@oracle.com>
Reviewed-by: default avatarEric Engestrom <eric.engestrom@imgtec.com>
[fixed fmt string warning (s/%ld/%d/)]
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 30c6bfe8
...@@ -302,21 +302,24 @@ static void edp_clk_disable(struct edp_ctrl *ctrl, u32 clk_mask) ...@@ -302,21 +302,24 @@ static void edp_clk_disable(struct edp_ctrl *ctrl, u32 clk_mask)
static int edp_regulator_init(struct edp_ctrl *ctrl) static int edp_regulator_init(struct edp_ctrl *ctrl)
{ {
struct device *dev = &ctrl->pdev->dev; struct device *dev = &ctrl->pdev->dev;
int ret;
DBG(""); DBG("");
ctrl->vdda_vreg = devm_regulator_get(dev, "vdda"); ctrl->vdda_vreg = devm_regulator_get(dev, "vdda");
if (IS_ERR(ctrl->vdda_vreg)) { ret = PTR_ERR_OR_ZERO(ctrl->vdda_vreg);
pr_err("%s: Could not get vdda reg, ret = %ld\n", __func__, if (ret) {
PTR_ERR(ctrl->vdda_vreg)); pr_err("%s: Could not get vdda reg, ret = %d\n", __func__,
ret);
ctrl->vdda_vreg = NULL; ctrl->vdda_vreg = NULL;
return PTR_ERR(ctrl->vdda_vreg); return ret;
} }
ctrl->lvl_vreg = devm_regulator_get(dev, "lvl-vdd"); ctrl->lvl_vreg = devm_regulator_get(dev, "lvl-vdd");
if (IS_ERR(ctrl->lvl_vreg)) { ret = PTR_ERR_OR_ZERO(ctrl->lvl_vreg);
pr_err("Could not get lvl-vdd reg, %ld", if (ret) {
PTR_ERR(ctrl->lvl_vreg)); pr_err("%s: Could not get lvl-vdd reg, ret = %d\n", __func__,
ret);
ctrl->lvl_vreg = NULL; ctrl->lvl_vreg = NULL;
return PTR_ERR(ctrl->lvl_vreg); return ret;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment