diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 85226cc5426..f82ac1b5c59 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -1346,7 +1346,7 @@ static void att_read_rsp(struct bt_conn *conn, uint8_t err, const void *pdu, BT_DBG("err 0x%02x", err); - if (err) { + if (err || !length) { params->func(conn, err, params, NULL, 0); return; } @@ -1355,11 +1355,6 @@ static void att_read_rsp(struct bt_conn *conn, uint8_t err, const void *pdu, return; } - /* Stop if no data left */ - if (!length) { - return; - } - /* * Core Spec 4.2, Vol. 3, Part G, 4.8.1 * If the Characteristic Value is greater than (ATT_MTU - 1) octets @@ -1408,17 +1403,13 @@ static void att_read_multiple_rsp(struct bt_conn *conn, uint8_t err, BT_DBG("err 0x%02x", err); - if (err) { + if (err || !length) { params->func(conn, err, params, NULL, 0); return; } params->func(conn, 0, params, pdu, length); - if (!length) { - return; - } - /* mark read as complete since read multiple is single response */ params->func(conn, 0, params, NULL, 0); }