From 643b074d7dc7f722588192eea852ce2e0d0584ae Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 26 Sep 2022 16:01:54 -0700 Subject: [PATCH] monitor/analyze: Fix scan-build warnings 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); ^ ~~~~~~~~~~~~ --- monitor/analyze.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/monitor/analyze.c b/monitor/analyze.c index 50e7e5542..a20ba98b0 100644 --- a/monitor/analyze.c +++ b/monitor/analyze.c @@ -375,12 +375,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; @@ -395,9 +391,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; @@ -415,9 +408,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; @@ -522,13 +512,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, @@ -623,12 +606,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; @@ -643,9 +622,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; @@ -704,12 +680,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; -- 2.47.3