summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorBranislav Radocaj <branislav@radocaj.org>2017-12-07 14:11:47 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-15 20:27:44 +0100
commit5c3055393f5fdd0bdc4b69b1fb362b1c3f4266b4 (patch)
tree480aafd0e44036ae168fda3a1be54224d8135e42 /drivers/tty
parent6a28fd2bbc94bfca105632e5ef8a9dbe63ba0b39 (diff)
downloadlinux-5c3055393f5fdd0bdc4b69b1fb362b1c3f4266b4.tar.bz2
tty: serial: mxs-auart: fix error handling in mxs_auart_probe
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>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/mxs-auart.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index efb4fd3784ed..5b470406bf9d 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -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;