The if-clause for hdev->setup should also include the error handling since that is where the error really comes from. The code currently works correctly since ret=0 is assigned early on, but it is a lot harder to read and understand. Signed-off-by: Marcel Holtmann <marcel@xxxxxxxxxxxx> --- net/bluetooth/hci_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 0cc9ce917222..c957f0611f74 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1446,11 +1446,11 @@ static int hci_dev_do_open(struct hci_dev *hdev) test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks)) { hci_sock_dev_event(hdev, HCI_DEV_SETUP); - if (hdev->setup) + if (hdev->setup) { ret = hdev->setup(hdev); - - if (ret) - goto setup_failed; + if (ret) + goto setup_failed; + } if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks)) { if (!bacmp(&hdev->public_addr, BDADDR_ANY)) -- 2.23.0