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: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
committed by
Johan Hedberg
parent
ceff86af56
commit
31a3248dd9
@@ -6700,17 +6700,19 @@ static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data,
|
|||||||
int i, cur_len;
|
int i, cur_len;
|
||||||
bool flags_managed = false;
|
bool flags_managed = false;
|
||||||
bool tx_power_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)) {
|
if (is_adv_data) {
|
||||||
flags_managed = true;
|
if (adv_flags & (MGMT_ADV_FLAG_DISCOV |
|
||||||
max_len -= 3;
|
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)) {
|
if (adv_flags & MGMT_ADV_FLAG_TX_POWER) {
|
||||||
tx_power_managed = true;
|
tx_power_managed = true;
|
||||||
max_len -= 3;
|
max_len -= 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len > max_len)
|
if (len > max_len)
|
||||||
|
|||||||
Reference in New Issue
Block a user