Commit d8edf8eb authored by Chuhong Yuan's avatar Chuhong Yuan Committed by Greg Kroah-Hartman

serial: mxs-auart: add missed iounmap() in probe failure and remove

This driver calls ioremap() in probe, but it misses calling iounmap() in
probe's error handler and remove.
Add the missed calls to fix it.

Fixes: 47d37d6f ("serial: Add auart driver for i.MX23/28")
Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200709135608.68290-1-hslester96@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f38278e9
...@@ -1698,21 +1698,21 @@ static int mxs_auart_probe(struct platform_device *pdev) ...@@ -1698,21 +1698,21 @@ static int mxs_auart_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
ret = irq; ret = irq;
goto out_disable_clks; goto out_iounmap;
} }
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)
goto out_disable_clks; goto out_iounmap;
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");
goto out_disable_clks; goto out_iounmap;
} }
/* /*
...@@ -1720,7 +1720,7 @@ static int mxs_auart_probe(struct platform_device *pdev) ...@@ -1720,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)
goto out_disable_clks; goto out_iounmap;
auart_port[s->port.line] = s; auart_port[s->port.line] = s;
...@@ -1746,6 +1746,9 @@ static int mxs_auart_probe(struct platform_device *pdev) ...@@ -1746,6 +1746,9 @@ static int mxs_auart_probe(struct platform_device *pdev)
mxs_auart_free_gpio_irq(s); mxs_auart_free_gpio_irq(s);
auart_port[pdev->id] = NULL; auart_port[pdev->id] = NULL;
out_iounmap:
iounmap(s->port.membase);
out_disable_clks: out_disable_clks:
if (is_asm9260_auart(s)) { if (is_asm9260_auart(s)) {
clk_disable_unprepare(s->clk); clk_disable_unprepare(s->clk);
...@@ -1761,6 +1764,7 @@ static int mxs_auart_remove(struct platform_device *pdev) ...@@ -1761,6 +1764,7 @@ 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);
iounmap(s->port.membase);
if (is_asm9260_auart(s)) { if (is_asm9260_auart(s)) {
clk_disable_unprepare(s->clk); clk_disable_unprepare(s->clk);
clk_disable_unprepare(s->clk_ahb); clk_disable_unprepare(s->clk_ahb);
......
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