aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2013-10-10 06:08:10 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2013-10-10 06:54:51 -0400
commit72ef0c1a9e62c3dd3b4841c8c8a1f259bf7b5d94 (patch)
tree6e6579ee9c272fe4fe0bdbeb8cab298cb35b78a7 /net/bluetooth/mgmt.c
parent620ad5219c0f0aa43731b2fd8fd9efac78c10deb (diff)
Bluetooth: Remove unneeded val variable when setting SSP
The variable val in the set_ssp() function of the management interface is not needed. Just use cp->val directly since its input values have already been validated. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index a9d7506be1a3..2fb4d35e04dc 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1290,7 +1290,7 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
1290{ 1290{
1291 struct mgmt_mode *cp = data; 1291 struct mgmt_mode *cp = data;
1292 struct pending_cmd *cmd; 1292 struct pending_cmd *cmd;
1293 u8 val, status; 1293 u8 status;
1294 int err; 1294 int err;
1295 1295
1296 BT_DBG("request for %s", hdev->name); 1296 BT_DBG("request for %s", hdev->name);
@@ -1309,8 +1309,6 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
1309 1309
1310 hci_dev_lock(hdev); 1310 hci_dev_lock(hdev);
1311 1311
1312 val = !!cp->val;
1313
1314 if (!hdev_is_powered(hdev)) { 1312 if (!hdev_is_powered(hdev)) {
1315 bool changed = false; 1313 bool changed = false;
1316 1314
@@ -1335,7 +1333,7 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
1335 goto failed; 1333 goto failed;
1336 } 1334 }
1337 1335
1338 if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) == val) { 1336 if (!!cp->val == test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) {
1339 err = send_settings_rsp(sk, MGMT_OP_SET_SSP, hdev); 1337 err = send_settings_rsp(sk, MGMT_OP_SET_SSP, hdev);
1340 goto failed; 1338 goto failed;
1341 } 1339 }
@@ -1346,7 +1344,7 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
1346 goto failed; 1344 goto failed;
1347 } 1345 }
1348 1346
1349 err = hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, sizeof(val), &val); 1347 err = hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, 1, &cp->val);
1350 if (err < 0) { 1348 if (err < 0) {
1351 mgmt_pending_remove(cmd); 1349 mgmt_pending_remove(cmd);
1352 goto failed; 1350 goto failed;