Thread (9 messages) 9 messages, 2 authors, 2019-11-01
STALE2440d LANDED: 2 (0M)
Revisions (7)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v1 [diff vs current]
  6. v6 [diff vs current]
  7. v7 current

[PATCH v7 02/15] drivers: thermal: tsens: Simplify code flow in tsens_probe

From: Amit Kucheria <hidden>
Date: 2019-10-31 18:38:02
Also in: linux-arm-msm, lkml
Subsystem: arm/qualcomm mailing list, qualcomm tsens thermal driver, the rest, thermal · Maintainers: Amit Kucheria, Thara Gopinath, Linus Torvalds, Rafael J. Wysocki, Daniel Lezcano

Move platform_set_drvdata up to avoid an extra 'if (ret)' check after
the call to tsens_register.

Signed-off-by: Amit Kucheria <redacted>
Reviewed-by: Stephen Boyd <redacted>
Reviewed-by: Daniel Lezcano <redacted>
---
 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 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)
-- 
2.17.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help