Commit 4803c54c authored by Chuhong Yuan's avatar Chuhong Yuan Committed by Marcel Holtmann

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: 05582561 ("Bluetooth: btmtkuart: add an implementation for clock osc property")
Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent feac90d7
...@@ -1015,7 +1015,7 @@ static int btmtkuart_probe(struct serdev_device *serdev) ...@@ -1015,7 +1015,7 @@ static int btmtkuart_probe(struct serdev_device *serdev)
if (btmtkuart_is_standalone(bdev)) { if (btmtkuart_is_standalone(bdev)) {
err = clk_prepare_enable(bdev->osc); err = clk_prepare_enable(bdev->osc);
if (err < 0) if (err < 0)
return err; goto err_hci_free_dev;
if (bdev->boot) { if (bdev->boot) {
gpiod_set_value_cansleep(bdev->boot, 1); gpiod_set_value_cansleep(bdev->boot, 1);
...@@ -1028,10 +1028,8 @@ static int btmtkuart_probe(struct serdev_device *serdev) ...@@ -1028,10 +1028,8 @@ static int btmtkuart_probe(struct serdev_device *serdev)
/* Power on */ /* Power on */
err = regulator_enable(bdev->vcc); err = regulator_enable(bdev->vcc);
if (err < 0) { if (err < 0)
clk_disable_unprepare(bdev->osc); goto err_clk_disable_unprepare;
return err;
}
/* Reset if the reset-gpios is available otherwise the board /* Reset if the reset-gpios is available otherwise the board
* -level design should be guaranteed. * -level design should be guaranteed.
...@@ -1063,7 +1061,6 @@ static int btmtkuart_probe(struct serdev_device *serdev) ...@@ -1063,7 +1061,6 @@ static int btmtkuart_probe(struct serdev_device *serdev)
err = hci_register_dev(hdev); err = hci_register_dev(hdev);
if (err < 0) { if (err < 0) {
dev_err(&serdev->dev, "Can't register HCI device\n"); dev_err(&serdev->dev, "Can't register HCI device\n");
hci_free_dev(hdev);
goto err_regulator_disable; goto err_regulator_disable;
} }
...@@ -1072,6 +1069,11 @@ static int btmtkuart_probe(struct serdev_device *serdev) ...@@ -1072,6 +1069,11 @@ static int btmtkuart_probe(struct serdev_device *serdev)
err_regulator_disable: err_regulator_disable:
if (btmtkuart_is_standalone(bdev)) if (btmtkuart_is_standalone(bdev))
regulator_disable(bdev->vcc); regulator_disable(bdev->vcc);
err_clk_disable_unprepare:
if (btmtkuart_is_standalone(bdev))
clk_disable_unprepare(bdev->osc);
err_hci_free_dev:
hci_free_dev(hdev);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment