diff options
author | Amit Kucheria <amit.kucheria@linaro.org> | 2019-10-31 21:37:26 +0300 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2019-11-07 09:00:26 +0300 |
commit | 0e9c0bc73082403ec13361c4af9e9243d88f9580 (patch) | |
tree | f4c2bbcfc9fbe49e214eb63285f5260ed27b6e83 | |
parent | 8b71bce407b3f13c5db3795ee469da7773a7d230 (diff) | |
download | linux-0e9c0bc73082403ec13361c4af9e9243d88f9580.tar.xz |
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@linaro.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/184422dcc1c12553e71a58c62e01425fd7d1172a.1572526427.git.amit.kucheria@linaro.org
-rw-r--r-- | drivers/thermal/qcom/tsens.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c index 6ed687a6e53c..542a7f8c3d96 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) |