提交 31a3248d 编写于 作者: M Marcel Holtmann 提交者: Johan Hedberg

Bluetooth: Simplify if statements in tlv_data_is_valid function

The if statements for checking the flags parameter could be written a
bit easier to read. This changes this. No functional behavior has been
changed.
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
上级 ceff86af
......@@ -6700,17 +6700,19 @@ static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data,
int i, cur_len;
bool flags_managed = false;
bool tx_power_managed = false;
u32 flags_params = MGMT_ADV_FLAG_DISCOV | MGMT_ADV_FLAG_LIMITED_DISCOV |
MGMT_ADV_FLAG_MANAGED_FLAGS;
if (is_adv_data && (adv_flags & flags_params)) {
flags_managed = true;
max_len -= 3;
}
if (is_adv_data) {
if (adv_flags & (MGMT_ADV_FLAG_DISCOV |
MGMT_ADV_FLAG_LIMITED_DISCOV |
MGMT_ADV_FLAG_MANAGED_FLAGS)) {
flags_managed = true;
max_len -= 3;
}
if (is_adv_data && (adv_flags & MGMT_ADV_FLAG_TX_POWER)) {
tx_power_managed = true;
max_len -= 3;
if (adv_flags & MGMT_ADV_FLAG_TX_POWER) {
tx_power_managed = true;
max_len -= 3;
}
}
if (len > max_len)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册