]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tools/thermal/tmon: Fix compilation warning for wrong format
authorFlorian Eckert <fe@dev.tdt.de>
Mon, 4 Dec 2023 14:13:35 +0000 (15:13 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 2 Jan 2024 08:33:19 +0000 (09:33 +0100)
The following warnings are shown during compilation:

tui.c: In function 'show_cooling_device':
 tui.c:216:40: 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:44: 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

To fix this, the correct string format must be used for printing.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20231204141335.2798194-1-fe@dev.tdt.de
tools/thermal/tmon/tui.c

index 031b258667d8cfe8adb34192f66197764cd901da..7f5dd2b87f15fbb3f985965e1e00f0d4a0d5c848 100644 (file)
@@ -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%6lu %6lu",
                        ptdata.cdi[j].instance,
                        ptdata.cdi[j].type,
                        ptdata.cdi[j].cur_state,