serial: mxs-auart: Disable clock on error path
authorFabio Estevam <fabio.estevam@nxp.com>
Fri, 9 Sep 2016 11:31:33 +0000 (08:31 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Sep 2016 16:54:34 +0000 (18:54 +0200)
We should disable the previously acquired clock when enabling s->clk
fails.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/mxs-auart.c

index 2f04ec2b5691aef1d74d8b09b3f50f0feaffeb21..680270b85ff7cf6499227aa5f47ee4a0243426cf 100644 (file)
@@ -1543,10 +1543,14 @@ static int mxs_get_clks(struct mxs_auart_port *s,
        err = clk_prepare_enable(s->clk);
        if (err) {
                dev_err(s->dev, "Failed to enable clk!\n");
-               return err;
+               goto disable_clk_ahb;
        }
 
        return 0;
+
+disable_clk_ahb:
+       clk_disable_unprepare(s->clk_ahb);
+       return err;
 }
 
 /*