980-tools-thermal-tmon-Fix-compilation-warning-for-wrong.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From a7a94ca21ac0f347f683d33c72b4aab57ce5eec3 Mon Sep 17 00:00:00 2001
  2. From: Florian Eckert <[email protected]>
  3. Date: Mon, 20 Nov 2023 11:13:20 +0100
  4. Subject: [PATCH] tools/thermal/tmon: Fix compilation warning for wrong format
  5. The following warnings are shown during compilation:
  6. tui.c: In function 'show_cooling_device':
  7. tui.c:216:40: warning: format '%d' expects argument of type 'int', but
  8. argument 7 has type 'long unsigned int' [-Wformat=]
  9. 216 | "%02d %12.12s%6d %6d",
  10. | ~~^
  11. | |
  12. | int
  13. | %6ld
  14. ......
  15. 219 | ptdata.cdi[j].cur_state,
  16. | ~~~~~~~~~~~~~~~~~~~~~~~
  17. | |
  18. | long unsigned int
  19. tui.c:216:44: warning: format '%d' expects argument of type 'int', but
  20. argument 8 has type 'long unsigned int' [-Wformat=]
  21. 216 | "%02d %12.12s%6d %6d",
  22. | ~~^
  23. | |
  24. | int
  25. | %6ld
  26. ......
  27. 220 | ptdata.cdi[j].max_state);
  28. | ~~~~~~~~~~~~~~~~~~~~~~~
  29. | |
  30. | long unsigned int
  31. To fix this, the correct string format must be used for printing.
  32. Signed-off-by: Florian Eckert <[email protected]>
  33. ---
  34. tools/thermal/tmon/tui.c | 2 +-
  35. 1 file changed, 1 insertion(+), 1 deletion(-)
  36. --- a/tools/thermal/tmon/tui.c
  37. +++ b/tools/thermal/tmon/tui.c
  38. @@ -213,7 +213,7 @@ void show_cooling_device(void)
  39. * cooling device instances. skip unused idr.
  40. */
  41. mvwprintw(cooling_device_window, j + 2, 1,
  42. - "%02d %12.12s%6d %6d",
  43. + "%02d %12.12s%6lu %6lu",
  44. ptdata.cdi[j].instance,
  45. ptdata.cdi[j].type,
  46. ptdata.cdi[j].cur_state,