aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-06-18 14:05:31 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2015-06-18 14:05:31 -0400
commit952497b159468477392f9b562b904da9bc76d468 (patch)
tree7bd7066d0ae89dbca382ed83b688c1293f0e82df /net/bluetooth
parent39ecfad68f14b71b6d1917c27eb01c4936f88bda (diff)
Bluetooth: Fix warning of potentially uninitialized adv_instance variable
Rework the logic of checking for a valid adv_instance for non-zero cp->instance values. Without this change we may get (false positive) warnings as follows: >> net/bluetooth/mgmt.c:7294:29: warning: 'adv_instance' may be used uninitialized in this function [-Wuninitialized] Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/mgmt.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 2fe6f3bfc579..7998fb279165 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -7280,19 +7280,15 @@ static int remove_advertising(struct sock *sk, struct hci_dev *hdev,
7280{ 7280{
7281 struct mgmt_cp_remove_advertising *cp = data; 7281 struct mgmt_cp_remove_advertising *cp = data;
7282 struct mgmt_rp_remove_advertising rp; 7282 struct mgmt_rp_remove_advertising rp;
7283 struct adv_info *adv_instance;
7284 int err;
7285 struct mgmt_pending_cmd *cmd; 7283 struct mgmt_pending_cmd *cmd;
7286 struct hci_request req; 7284 struct hci_request req;
7285 int err;
7287 7286
7288 BT_DBG("%s", hdev->name); 7287 BT_DBG("%s", hdev->name);
7289 7288
7290 hci_dev_lock(hdev); 7289 hci_dev_lock(hdev);
7291 7290
7292 if (cp->instance) 7291 if (cp->instance && !hci_find_adv_instance(hdev, cp->instance)) {
7293 adv_instance = hci_find_adv_instance(hdev, cp->instance);
7294
7295 if (!(cp->instance == 0x00 || adv_instance)) {
7296 err = mgmt_cmd_status(sk, hdev->id, 7292 err = mgmt_cmd_status(sk, hdev->id,
7297 MGMT_OP_REMOVE_ADVERTISING, 7293 MGMT_OP_REMOVE_ADVERTISING,
7298 MGMT_STATUS_INVALID_PARAMS); 7294 MGMT_STATUS_INVALID_PARAMS);