diff mbox series

[2/2] tools/thermal: tmon: fix format unexpected build warning

Message ID 20221031132110.65847-2-wangxiongfeng2@huawei.com (mailing list archive)
State New, archived
Delegated to: Daniel Lezcano
Headers show
Series [1/2] tools/thermal: tmon: fix build warning caused by misusing strncpy() | expand

Commit Message

Xiongfeng Wang Oct. 31, 2022, 1:21 p.m. UTC
Building tmon tools emits the following warning. This patch fix it by
correcting the print formats.

tui.c: In function ‘show_cooling_device’:
tui.c:216:19: warning: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘long unsigned int’ [-Wformat=]
  216 |    "%02d %12.12s%6d %6d",
      |                 ~~^
      |                   |
      |                   int
      |                 %6ld
......
  219 |    ptdata.cdi[j].cur_state,
      |    ~~~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 long unsigned int
tui.c:216:23: warning: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘long unsigned int’ [-Wformat=]
  216 |    "%02d %12.12s%6d %6d",
      |                     ~~^
      |                       |
      |                       int
      |                     %6ld
......
  220 |    ptdata.cdi[j].max_state);
      |    ~~~~~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 long unsigned int

Fixes: 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal subsystem")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 tools/thermal/tmon/tui.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/thermal/tmon/tui.c b/tools/thermal/tmon/tui.c
index 031b258667d8..ed736fef1fe0 100644
--- a/tools/thermal/tmon/tui.c
+++ b/tools/thermal/tmon/tui.c
@@ -213,7 +213,7 @@  void show_cooling_device(void)
 		 * cooling device instances. skip unused idr.
 		 */
 		mvwprintw(cooling_device_window, j + 2, 1,
-			"%02d %12.12s%6d %6d",
+			"%02d %12.12s%6ld %6ld",
 			ptdata.cdi[j].instance,
 			ptdata.cdi[j].type,
 			ptdata.cdi[j].cur_state,