monitor/packet: Fix scan-build warnings
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 27 Sep 2022 19:24:19 +0000 (12:24 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:55 +0000 (14:55 +0530)
This fixes the following warnings:

monitor/packet.c:410:4: warning: Value stored to 'ts_pos' is never read
[deadcode.DeadStores]
                        ts_pos += n;
                        ^         ~
monitor/packet.c:455:4: warning: Value stored to 'pos' is never read
[deadcode.DeadStores]
                        pos += n;
                        ^      ~
monitor/packet.c:7477:2: warning: Value stored to 'mask' is never read
[deadcode.DeadStores]
        mask = tx_phys;
        ^      ~~~~~~~
monitor/packet.c:7485:2: warning: Value stored to 'mask' is never read
[deadcode.DeadStores]
        mask = rx_phys;
        ^      ~~~~~~~
monitor/packet.c:11229:3: warning: Value stored to 'str' is never read
[deadcode.DeadStores]
                str = "AoA Constant Tone Extension";
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
monitor/packet.c:11232:3: warning: Value stored to 'str' is never read
[deadcode.DeadStores]
                str = "AoA Constant Tone Extension with 1us slots";
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
monitor/packet.c:11235:3: warning: Value stored to 'str' is never read
[deadcode.DeadStores]
                str = "AoD Constant Tone Extension with 2us slots";
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
monitor/packet.c:11238:3: warning: Value stored to 'str' is never read
[deadcode.DeadStores]
                str = "No Constant Tone Extension";
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
monitor/packet.c:11241:3: warning: Value stored to 'str' is never read
[deadcode.DeadStores]
                str = "Reserved";
                ^     ~~~~~~~~~~
monitor/packet.c:11242:3: warning: Value stored to 'color_on' is never read
[deadcode.DeadStores]
                color_on = COLOR_RED;
                ^          ~~~~~~~~~

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
monitor/packet.c

index afbc010..b00d0cc 100755 (executable)
@@ -404,12 +404,7 @@ static void print_packet(struct timeval *tv, struct ucred *cred, char ident,
        }
 
        if (use_color()) {
-               n = sprintf(ts_str + ts_pos, "%s", COLOR_OFF);
-               if (n > 0)
-                       ts_pos += n;
-       }
-
-       if (use_color()) {
+               sprintf(ts_str + ts_pos, "%s", COLOR_OFF);
                n = sprintf(line + pos, "%s", color);
                if (n > 0)
                        pos += n;
@@ -450,10 +445,8 @@ static void print_packet(struct timeval *tv, struct ucred *cred, char ident,
 
        if (extra) {
                n = sprintf(line + pos, " %s", extra);
-               if (n > 0) {
-                       pos += n;
+               if (n > 0)
                        len += n;
-               }
        }
 
        if (ts_len > 0) {
@@ -7468,7 +7461,6 @@ static void print_le_phys_preference(uint8_t all_phys, uint8_t tx_phys,
                                                        " (0x%2.2x)", mask);
 
        print_field("TX PHYs preference: 0x%2.2x", tx_phys);
-       mask = tx_phys;
 
        mask = print_bitfield(2, tx_phys, le_phys);
        if (mask)
@@ -7476,7 +7468,6 @@ static void print_le_phys_preference(uint8_t all_phys, uint8_t tx_phys,
                                                        " (0x%2.2x)", mask);
 
        print_field("RX PHYs preference: 0x%2.2x", rx_phys);
-       mask = rx_phys;
 
        mask = print_bitfield(2, rx_phys, le_phys);
        if (mask)
@@ -11245,10 +11236,11 @@ static void le_pa_report_evt(uint16_t index, const void *data, uint8_t size)
                break;
        default:
                str = "Reserved";
-               color_on = COLOR_RED;
                break;
        }
 
+       print_field("CTE Type: %s (0x%2x)", str, evt->cte_type);
+
        switch (evt->data_status) {
        case 0x00:
                str = "Complete";