From 44658f11cafb311703783d6e225c020b61fda54f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 7 May 2019 16:46:07 +0200 Subject: [PATCH] shared: Walk rp->opcodes directly instead of interim variable --- src/shared/gap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/shared/gap.c b/src/shared/gap.c index 4a21e5d2c..0b8d073c5 100644 --- a/src/shared/gap.c +++ b/src/shared/gap.c @@ -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; -- 2.47.3