830-v6.7-39-thermal-lvts-Convert-to-platform-remove-callback-ret.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From 6cf96078969ec00b873db99bae4e47001290685e Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <[email protected]>
  3. Date: Wed, 27 Sep 2023 21:37:23 +0200
  4. Subject: [PATCH 35/42] thermal: lvts: Convert to platform remove callback
  5. returning void
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. The .remove() callback for a platform driver returns an int which makes
  10. many driver authors wrongly assume it's possible to do error handling by
  11. returning an error code. However the value returned is ignored (apart
  12. from emitting a warning) and this typically results in resource leaks.
  13. To improve here there is a quest to make the remove callback return
  14. void. In the first step of this quest all drivers are converted to
  15. .remove_new(), which already returns void. Eventually after all drivers
  16. are converted, .remove_new() will be renamed to .remove().
  17. Trivially convert this driver from always returning zero in the remove
  18. callback to the void returning variant.
  19. Signed-off-by: Uwe Kleine-König <[email protected]>
  20. Acked-by: Daniel Lezcano <[email protected]>
  21. Signed-off-by: Rafael J. Wysocki <[email protected]>
  22. ---
  23. drivers/thermal/mediatek/lvts_thermal.c | 6 ++----
  24. 1 file changed, 2 insertions(+), 4 deletions(-)
  25. --- a/drivers/thermal/mediatek/lvts_thermal.c
  26. +++ b/drivers/thermal/mediatek/lvts_thermal.c
  27. @@ -1241,7 +1241,7 @@ static int lvts_probe(struct platform_de
  28. return 0;
  29. }
  30. -static int lvts_remove(struct platform_device *pdev)
  31. +static void lvts_remove(struct platform_device *pdev)
  32. {
  33. struct lvts_domain *lvts_td;
  34. int i;
  35. @@ -1252,8 +1252,6 @@ static int lvts_remove(struct platform_d
  36. lvts_ctrl_set_enable(&lvts_td->lvts_ctrl[i], false);
  37. lvts_debugfs_exit(lvts_td);
  38. -
  39. - return 0;
  40. }
  41. static const struct lvts_ctrl_data mt8195_lvts_mcu_data_ctrl[] = {
  42. @@ -1354,7 +1352,7 @@ MODULE_DEVICE_TABLE(of, lvts_of_match);
  43. static struct platform_driver lvts_driver = {
  44. .probe = lvts_probe,
  45. - .remove = lvts_remove,
  46. + .remove_new = lvts_remove,
  47. .driver = {
  48. .name = "mtk-lvts-thermal",
  49. .of_match_table = lvts_of_match,