[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e54d2381f481e688429b6910d2f76871b3b8fe9e.1566907161.git.amit.kucheria@linaro.org>
Date: Tue, 27 Aug 2019 17:43:58 +0530
From: Amit Kucheria <amit.kucheria@...aro.org>
To: linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
bjorn.andersson@...aro.org, edubezval@...il.com, agross@...nel.org,
sboyd@...nel.org, masneyb@...tation.org, marc.w.gonzalez@...e.fr,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Mark Rutland <mark.rutland@....com>,
Rob Herring <robh+dt@...nel.org>,
Zhang Rui <rui.zhang@...el.com>
Cc: linux-pm@...r.kernel.org
Subject: [PATCH v2 02/15] drivers: thermal: tsens: Simplify code flow in tsens_probe
Move platform_set_drvdata up to avoid an extra 'if (ret)' check after
the call to tsens_register.
Signed-off-by: Amit Kucheria <amit.kucheria@...aro.org>
Reviewed-by: Stephen Boyd <swboyd@...omium.org>
Reviewed-by: Daniel Lezcano <daniel.lezcano@...aro.org>
---
drivers/thermal/qcom/tsens.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 6ed687a6e53cd..542a7f8c3d962 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -149,6 +149,8 @@ static int tsens_probe(struct platform_device *pdev)
priv->feat = data->feat;
priv->fields = data->fields;
+ platform_set_drvdata(pdev, priv);
+
if (!priv->ops || !priv->ops->init || !priv->ops->get_temp)
return -EINVAL;
@@ -167,11 +169,7 @@ static int tsens_probe(struct platform_device *pdev)
}
}
- ret = tsens_register(priv);
-
- platform_set_drvdata(pdev, priv);
-
- return ret;
+ return tsens_register(priv);
}
static int tsens_remove(struct platform_device *pdev)
--
2.17.1
Powered by blists - more mailing lists