Skip to contentSkip to conversation

tools/thermal/tmon: Fix compilation warning for wrong format

PATCH Applied Florian Eckert 2 participants 3 messages Dec 4, 2023 – Dec 20, 2023 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/thermal/tmon: Fix compilation warning for wrong format

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.

---
 tools/thermal/tmon/tui.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/thermal/tmon/tui.c +1 -1
index 031b258667d8..7f5dd2b87f15 100644
@@ -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,
Signature · 1 line
2.30.2
#1 lore raw
Quoted 28 lines · Florian Eckert

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
Quoted 4 lines

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

---

Applied, thanks

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#2 lore raw
Quoted 31 lines · Daniel Lezcano
Quoted 30 lines · Florian Eckert

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
Quoted 6 lines
Quoted 4 lines

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

---

Applied, thanks

Thanks :+1: