107-1-thermal-qcom-tsens-init-debugfs-only-with-successful.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From 8f32d48a309246a80bdca505968085a484d54408 Mon Sep 17 00:00:00 2001
  2. From: Ansuel Smith <[email protected]>
  3. Date: Mon, 19 Apr 2021 03:01:53 +0200
  4. Subject: [thermal-next PATCH v2 1/2] thermal: qcom: tsens: init debugfs only with
  5. successful probe
  6. calibrate and tsens_register can fail or PROBE_DEFER. This will cause a
  7. double or a wrong init of the debugfs information. Init debugfs only
  8. with successful probe fixing warning about directory already present.
  9. Signed-off-by: Ansuel Smith <[email protected]>
  10. Acked-by: Thara Gopinath <[email protected]>
  11. ---
  12. drivers/thermal/qcom/tsens.c | 9 ++++++---
  13. 1 file changed, 6 insertions(+), 3 deletions(-)
  14. --- a/drivers/thermal/qcom/tsens.c
  15. +++ b/drivers/thermal/qcom/tsens.c
  16. @@ -918,8 +918,6 @@ int __init init_common(struct tsens_priv
  17. if (tsens_version(priv) >= VER_0_1)
  18. tsens_enable_irq(priv);
  19. - tsens_debug_init(op);
  20. -
  21. err_put_device:
  22. put_device(&op->dev);
  23. return ret;
  24. @@ -1161,7 +1159,12 @@ static int tsens_probe(struct platform_d
  25. }
  26. }
  27. - return tsens_register(priv);
  28. + ret = tsens_register(priv);
  29. +
  30. + if (!ret)
  31. + tsens_debug_init(pdev);
  32. +
  33. + return ret;
  34. }
  35. static int tsens_remove(struct platform_device *pdev)