Skip to content

Commit 4803c54

Browse files
WillLesterholtmann
authored andcommitted
Bluetooth: btmtkuart: Improve exception handling in btmtuart_probe()
Calls of the functions clk_disable_unprepare() and hci_free_dev() were missing for the exception handling. Thus add the missed function calls together with corresponding jump targets. Fixes: 0558256 ("Bluetooth: btmtkuart: add an implementation for clock osc property") Signed-off-by: Chuhong Yuan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent feac90d commit 4803c54

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/bluetooth/btmtkuart.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ static int btmtkuart_probe(struct serdev_device *serdev)
10151015
if (btmtkuart_is_standalone(bdev)) {
10161016
err = clk_prepare_enable(bdev->osc);
10171017
if (err < 0)
1018-
return err;
1018+
goto err_hci_free_dev;
10191019

10201020
if (bdev->boot) {
10211021
gpiod_set_value_cansleep(bdev->boot, 1);
@@ -1028,10 +1028,8 @@ static int btmtkuart_probe(struct serdev_device *serdev)
10281028

10291029
/* Power on */
10301030
err = regulator_enable(bdev->vcc);
1031-
if (err < 0) {
1032-
clk_disable_unprepare(bdev->osc);
1033-
return err;
1034-
}
1031+
if (err < 0)
1032+
goto err_clk_disable_unprepare;
10351033

10361034
/* Reset if the reset-gpios is available otherwise the board
10371035
* -level design should be guaranteed.
@@ -1063,7 +1061,6 @@ static int btmtkuart_probe(struct serdev_device *serdev)
10631061
err = hci_register_dev(hdev);
10641062
if (err < 0) {
10651063
dev_err(&serdev->dev, "Can't register HCI device\n");
1066-
hci_free_dev(hdev);
10671064
goto err_regulator_disable;
10681065
}
10691066

@@ -1072,6 +1069,11 @@ static int btmtkuart_probe(struct serdev_device *serdev)
10721069
err_regulator_disable:
10731070
if (btmtkuart_is_standalone(bdev))
10741071
regulator_disable(bdev->vcc);
1072+
err_clk_disable_unprepare:
1073+
if (btmtkuart_is_standalone(bdev))
1074+
clk_disable_unprepare(bdev->osc);
1075+
err_hci_free_dev:
1076+
hci_free_dev(hdev);
10751077

10761078
return err;
10771079
}

0 commit comments

Comments
 (0)