tty: serial: mxs-auart: fix error handling in mxs_auart_probe
authorBranislav Radocaj <branislav@radocaj.org>
Thu, 7 Dec 2017 13:11:47 +0000 (14:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Dec 2017 19:27:44 +0000 (20:27 +0100)
If uart_add_one_port() fails in mxs_auart_probe, the clks has
to be disabled.Two clks are previously enabled in mxs_get_clks().
Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Branislav Radocaj <branislav@radocaj.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/mxs-auart.c

index efb4fd3784ed75c1c86948f2e387b2960a22bf68..5b470406bf9d67d591ca7ef818127c906a1f6fd7 100644 (file)
@@ -1721,7 +1721,7 @@ static int mxs_auart_probe(struct platform_device *pdev)
 
        ret = uart_add_one_port(&auart_driver, &s->port);
        if (ret)
-               goto out_free_gpio_irq;
+               goto out_disable_clks_free_qpio_irq;
 
        /* ASM9260 don't have version reg */
        if (is_asm9260_auart(s)) {
@@ -1735,7 +1735,11 @@ static int mxs_auart_probe(struct platform_device *pdev)
 
        return 0;
 
-out_free_gpio_irq:
+out_disable_clks_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);
        auart_port[pdev->id] = NULL;
        return ret;