Skip to content

Commit 61969ef

Browse files
pr0gr4mholtmann
authored andcommitted
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>
1 parent f41a4b2 commit 61969ef

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

net/bluetooth/hci_core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,6 +1724,7 @@ static void hci_pend_le_actions_clear(struct hci_dev *hdev)
17241724
int hci_dev_do_close(struct hci_dev *hdev)
17251725
{
17261726
bool auto_off;
1727+
int err = 0;
17271728

17281729
BT_DBG("%s %p", hdev->name, hdev);
17291730

@@ -1738,13 +1739,13 @@ int hci_dev_do_close(struct hci_dev *hdev)
17381739
test_bit(HCI_UP, &hdev->flags)) {
17391740
/* Execute vendor specific shutdown routine */
17401741
if (hdev->shutdown)
1741-
hdev->shutdown(hdev);
1742+
err = hdev->shutdown(hdev);
17421743
}
17431744

17441745
if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
17451746
cancel_delayed_work_sync(&hdev->cmd_timer);
17461747
hci_req_sync_unlock(hdev);
1747-
return 0;
1748+
return err;
17481749
}
17491750

17501751
hci_leds_update_powered(hdev, false);
@@ -1851,7 +1852,7 @@ int hci_dev_do_close(struct hci_dev *hdev)
18511852
hci_req_sync_unlock(hdev);
18521853

18531854
hci_dev_put(hdev);
1854-
return 0;
1855+
return err;
18551856
}
18561857

18571858
int hci_dev_close(__u16 dev)

0 commit comments

Comments
 (0)