Skip to content

Commit 8a3b547

Browse files
Doug Bergergregkh
authored andcommitted
serial: 8250_bcm7271: balance clk_enable calls
The sw_baud clock must be disabled when the device driver is not connected to the device. This now occurs when probe fails and upon remove. Fixes: 41a4694 ("serial: 8250: Add new 8250-core based Broadcom STB driver") Reported-by: XuDong Liu <m202071377@hust.edu.cn> Link: https://lore.kernel.org/lkml/20230424125100.4783-1-m202071377@hust.edu.cn/ Signed-off-by: Doug Berger <opendmb@gmail.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20230427181916.2983697-2-opendmb@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8ab5fc5 commit 8a3b547

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/tty/serial/8250/8250_bcm7271.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ static int brcmuart_probe(struct platform_device *pdev)
10321032
if (clk_rate == 0) {
10331033
dev_err(dev, "clock-frequency or clk not defined\n");
10341034
ret = -EINVAL;
1035-
goto release_dma;
1035+
goto err_clk_disable;
10361036
}
10371037

10381038
dev_dbg(dev, "DMA is %senabled\n", priv->dma_enabled ? "" : "not ");
@@ -1119,6 +1119,8 @@ static int brcmuart_probe(struct platform_device *pdev)
11191119
serial8250_unregister_port(priv->line);
11201120
err:
11211121
brcmuart_free_bufs(dev, priv);
1122+
err_clk_disable:
1123+
clk_disable_unprepare(baud_mux_clk);
11221124
release_dma:
11231125
if (priv->dma_enabled)
11241126
brcmuart_arbitration(priv, 0);
@@ -1133,6 +1135,7 @@ static int brcmuart_remove(struct platform_device *pdev)
11331135
hrtimer_cancel(&priv->hrt);
11341136
serial8250_unregister_port(priv->line);
11351137
brcmuart_free_bufs(&pdev->dev, priv);
1138+
clk_disable_unprepare(priv->baud_mux_clk);
11361139
if (priv->dma_enabled)
11371140
brcmuart_arbitration(priv, 0);
11381141
return 0;

0 commit comments

Comments
 (0)