monitor/analyze: Fix scan-build warnings
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 26 Sep 2022 23:01:54 +0000 (16:01 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:55 +0000 (14:55 +0530)
This fixes the following warnings:

monitor/analyze.c:381:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:382:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:398:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*evt);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:399:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*evt);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:418:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*evt);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:419:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*evt);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:527:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(subtype);
        ^       ~~~~~~~~~~~~~~~
monitor/analyze.c:528:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(subtype);
        ^       ~~~~~~~~~~~~~~~
monitor/analyze.c:629:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:630:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:646:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:647:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:710:2: warning: Value stored to 'data' is never read
[deadcode.DeadStores]
        data += sizeof(*hdr);
        ^       ~~~~~~~~~~~~
monitor/analyze.c:711:2: warning: Value stored to 'size' is never read
[deadcode.DeadStores]
        size -= sizeof(*hdr);
        ^       ~~~~~~~~~~~~

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

index 4f0ebb2..74d8886 100755 (executable)
@@ -377,12 +377,8 @@ static void del_index(struct timeval *tv, uint16_t index,
 static void command_pkt(struct timeval *tv, uint16_t index,
                                        const void *data, uint16_t size)
 {
-       const struct bt_hci_cmd_hdr *hdr = data;
        struct hci_dev *dev;
 
-       data += sizeof(*hdr);
-       size -= sizeof(*hdr);
-
        dev = dev_lookup(index);
        if (!dev)
                return;
@@ -397,9 +393,6 @@ static void evt_conn_complete(struct hci_dev *dev, struct timeval *tv,
        const struct bt_hci_evt_conn_complete *evt = data;
        struct hci_conn *conn;
 
-       data += sizeof(*evt);
-       size -= sizeof(*evt);
-
        if (evt->status)
                return;
 
@@ -417,9 +410,6 @@ static void evt_disconnect_complete(struct hci_dev *dev, struct timeval *tv,
        const struct bt_hci_evt_disconnect_complete *evt = data;
        struct hci_conn *conn;
 
-       data += sizeof(*evt);
-       size -= sizeof(*evt);
-
        if (evt->status)
                return;
 
@@ -524,13 +514,6 @@ static void evt_num_completed_packets(struct hci_dev *dev, struct timeval *tv,
 static void evt_le_meta_event(struct hci_dev *dev, struct timeval *tv,
                                        const void *data, uint16_t size)
 {
-       uint8_t subtype = get_u8(data);
-
-       data += sizeof(subtype);
-       size -= sizeof(subtype);
-
-       switch (subtype) {
-       }
 }
 
 static void event_pkt(struct timeval *tv, uint16_t index,
@@ -625,12 +608,8 @@ static void acl_pkt(struct timeval *tv, uint16_t index, bool out,
 static void sco_pkt(struct timeval *tv, uint16_t index,
                                        const void *data, uint16_t size)
 {
-       const struct bt_hci_sco_hdr *hdr = data;
        struct hci_dev *dev;
 
-       data += sizeof(*hdr);
-       size -= sizeof(*hdr);
-
        dev = dev_lookup(index);
        if (!dev)
                return;
@@ -645,9 +624,6 @@ static void info_index(struct timeval *tv, uint16_t index,
        const struct btsnoop_opcode_index_info *hdr = data;
        struct hci_dev *dev;
 
-       data += sizeof(*hdr);
-       size -= sizeof(*hdr);
-
        dev = dev_lookup(index);
        if (!dev)
                return;
@@ -706,12 +682,8 @@ static void ctrl_msg(struct timeval *tv, uint16_t index,
 static void iso_pkt(struct timeval *tv, uint16_t index,
                                        const void *data, uint16_t size)
 {
-       const struct bt_hci_iso_hdr *hdr = data;
        struct hci_dev *dev;
 
-       data += sizeof(*hdr);
-       size -= sizeof(*hdr);
-
        dev = dev_lookup(index);
        if (!dev)
                return;