diff options
author | Kangmin Park <l4stpr0gr4m@gmail.com> | 2021-08-20 00:27:18 +0900 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2021-08-19 17:28:40 +0200 |
commit | 61969ef867d48fc76551fe50cefe0501e624766e (patch) | |
tree | f5fdbf9949247482448f7da8659816aedf01f815 /net/bluetooth | |
parent | f41a4b2b5eb7872109723dab8ae1603bdd9d9ec1 (diff) | |
download | linux-stable-61969ef867d48fc76551fe50cefe0501e624766e.tar.gz linux-stable-61969ef867d48fc76551fe50cefe0501e624766e.tar.bz2 linux-stable-61969ef867d48fc76551fe50cefe0501e624766e.zip |
Bluetooth: Fix return value in hci_dev_do_close()
hci_error_reset() return without calling hci_dev_do_open() when
hci_dev_do_close() return error value which is not 0.
Also, hci_dev_close() return hci_dev_do_close() function's return
value.
But, hci_dev_do_close() return always 0 even if hdev->shutdown
return error value. So, fix hci_dev_do_close() to save and return
the return value of the hdev->shutdown when it is called.
Signed-off-by: Kangmin Park <l4stpr0gr4m@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_core.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index f033c19e2f3b..fb296478b86e 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1724,6 +1724,7 @@ static void hci_pend_le_actions_clear(struct hci_dev *hdev) int hci_dev_do_close(struct hci_dev *hdev) { bool auto_off; + int err = 0; BT_DBG("%s %p", hdev->name, hdev); @@ -1738,13 +1739,13 @@ int hci_dev_do_close(struct hci_dev *hdev) test_bit(HCI_UP, &hdev->flags)) { /* Execute vendor specific shutdown routine */ if (hdev->shutdown) - hdev->shutdown(hdev); + err = hdev->shutdown(hdev); } if (!test_and_clear_bit(HCI_UP, &hdev->flags)) { cancel_delayed_work_sync(&hdev->cmd_timer); hci_req_sync_unlock(hdev); - return 0; + return err; } hci_leds_update_powered(hdev, false); @@ -1851,7 +1852,7 @@ int hci_dev_do_close(struct hci_dev *hdev) hci_req_sync_unlock(hdev); hci_dev_put(hdev); - return 0; + return err; } int hci_dev_close(__u16 dev) |