shared: Walk rp->opcodes directly instead of interim variable
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 7 May 2019 14:46:07 +0000 (16:46 +0200)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
Change-Id: I224aafcc8e219ff0f526d96f095e6bdc07cf3fcb
Signed-off-by: himanshu <h.himanshu@samsung.com>
src/shared/gap.c

index 4a21e5d..0b8d073 100755 (executable)
@@ -85,7 +85,6 @@ static void read_commands_complete(uint8_t status, uint16_t length,
        struct bt_gap *gap = user_data;
        const struct mgmt_rp_read_commands *rp = param;
        uint16_t num_commands, num_events;
-       const uint16_t *opcode;
        size_t expected_len;
        int i;
 
@@ -110,10 +109,8 @@ static void read_commands_complete(uint8_t status, uint16_t length,
                return;
        }
 
-       opcode = rp->opcodes;
-
        for (i = 0; i < num_commands; i++) {
-               uint16_t op = get_le16(opcode++);
+               uint16_t op = get_le16(rp->opcodes + i);
 
                if (op == MGMT_OP_ADD_DEVICE)
                        gap->flags |= FLAG_MGMT_CONN_CONTROL;