Commit ca7c22fc authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Greg Kroah-Hartman

serial: mxs-auart: disable clks of Alphascale ASM9260

In case of Alphascale ASM9260 probe() enables s->clk and s->clk_ahb
via mxs_get_clks(), but there is no disable of the clocks.
The patch adds it to error paths and to mxs_auart_remove().

Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Fixes: 254da0d7 ("serial: mxs-auart: add Alphascale ASM9260 support")
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7d6e2143
...@@ -1678,8 +1678,10 @@ static int mxs_auart_probe(struct platform_device *pdev) ...@@ -1678,8 +1678,10 @@ static int mxs_auart_probe(struct platform_device *pdev)
return ret; return ret;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r) if (!r) {
return -ENXIO; ret = -ENXIO;
goto out_disable_clks;
}
s->port.mapbase = r->start; s->port.mapbase = r->start;
s->port.membase = ioremap(r->start, resource_size(r)); s->port.membase = ioremap(r->start, resource_size(r));
...@@ -1694,21 +1696,23 @@ static int mxs_auart_probe(struct platform_device *pdev) ...@@ -1694,21 +1696,23 @@ static int mxs_auart_probe(struct platform_device *pdev)
s->mctrl_prev = 0; s->mctrl_prev = 0;
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) if (irq < 0) {
return irq; ret = irq;
goto out_disable_clks;
}
s->port.irq = irq; s->port.irq = irq;
ret = devm_request_irq(&pdev->dev, irq, mxs_auart_irq_handle, 0, ret = devm_request_irq(&pdev->dev, irq, mxs_auart_irq_handle, 0,
dev_name(&pdev->dev), s); dev_name(&pdev->dev), s);
if (ret) if (ret)
return ret; goto out_disable_clks;
platform_set_drvdata(pdev, s); platform_set_drvdata(pdev, s);
ret = mxs_auart_init_gpios(s, &pdev->dev); ret = mxs_auart_init_gpios(s, &pdev->dev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to initialize GPIOs.\n"); dev_err(&pdev->dev, "Failed to initialize GPIOs.\n");
return ret; goto out_disable_clks;
} }
/* /*
...@@ -1716,7 +1720,7 @@ static int mxs_auart_probe(struct platform_device *pdev) ...@@ -1716,7 +1720,7 @@ static int mxs_auart_probe(struct platform_device *pdev)
*/ */
ret = mxs_auart_request_gpio_irq(s); ret = mxs_auart_request_gpio_irq(s);
if (ret) if (ret)
return ret; goto out_disable_clks;
auart_port[s->port.line] = s; auart_port[s->port.line] = s;
...@@ -1724,7 +1728,7 @@ static int mxs_auart_probe(struct platform_device *pdev) ...@@ -1724,7 +1728,7 @@ static int mxs_auart_probe(struct platform_device *pdev)
ret = uart_add_one_port(&auart_driver, &s->port); ret = uart_add_one_port(&auart_driver, &s->port);
if (ret) if (ret)
goto out_disable_clks_free_qpio_irq; goto out_free_qpio_irq;
/* ASM9260 don't have version reg */ /* ASM9260 don't have version reg */
if (is_asm9260_auart(s)) { if (is_asm9260_auart(s)) {
...@@ -1738,13 +1742,15 @@ static int mxs_auart_probe(struct platform_device *pdev) ...@@ -1738,13 +1742,15 @@ static int mxs_auart_probe(struct platform_device *pdev)
return 0; return 0;
out_disable_clks_free_qpio_irq: out_free_qpio_irq:
if (s->clk)
clk_disable_unprepare(s->clk_ahb);
if (s->clk_ahb)
clk_disable_unprepare(s->clk_ahb);
mxs_auart_free_gpio_irq(s); mxs_auart_free_gpio_irq(s);
auart_port[pdev->id] = NULL; auart_port[pdev->id] = NULL;
out_disable_clks:
if (is_asm9260_auart(s)) {
clk_disable_unprepare(s->clk);
clk_disable_unprepare(s->clk_ahb);
}
return ret; return ret;
} }
...@@ -1755,6 +1761,10 @@ static int mxs_auart_remove(struct platform_device *pdev) ...@@ -1755,6 +1761,10 @@ static int mxs_auart_remove(struct platform_device *pdev)
uart_remove_one_port(&auart_driver, &s->port); uart_remove_one_port(&auart_driver, &s->port);
auart_port[pdev->id] = NULL; auart_port[pdev->id] = NULL;
mxs_auart_free_gpio_irq(s); mxs_auart_free_gpio_irq(s);
if (is_asm9260_auart(s)) {
clk_disable_unprepare(s->clk);
clk_disable_unprepare(s->clk_ahb);
}
return 0; return 0;
} }
......
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