Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 47d37d6f94cc ("serial: Add auart driver for i.MX23/28")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200709135608.68290-1-hslester96@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Chuhong Yuan and committed by
Greg Kroah-Hartman
d8edf8eb f38278e9

+8 -4
+8 -4
drivers/tty/serial/mxs-auart.c
··· 1698 1698 irq = platform_get_irq(pdev, 0); 1699 1699 if (irq < 0) { 1700 1700 ret = irq; 1701 - goto out_disable_clks; 1701 + goto out_iounmap; 1702 1702 } 1703 1703 1704 1704 s->port.irq = irq; 1705 1705 ret = devm_request_irq(&pdev->dev, irq, mxs_auart_irq_handle, 0, 1706 1706 dev_name(&pdev->dev), s); 1707 1707 if (ret) 1708 - goto out_disable_clks; 1708 + goto out_iounmap; 1709 1709 1710 1710 platform_set_drvdata(pdev, s); 1711 1711 1712 1712 ret = mxs_auart_init_gpios(s, &pdev->dev); 1713 1713 if (ret) { 1714 1714 dev_err(&pdev->dev, "Failed to initialize GPIOs.\n"); 1715 - goto out_disable_clks; 1715 + goto out_iounmap; 1716 1716 } 1717 1717 1718 1718 /* ··· 1720 1720 */ 1721 1721 ret = mxs_auart_request_gpio_irq(s); 1722 1722 if (ret) 1723 - goto out_disable_clks; 1723 + goto out_iounmap; 1724 1724 1725 1725 auart_port[s->port.line] = s; 1726 1726 ··· 1746 1746 mxs_auart_free_gpio_irq(s); 1747 1747 auart_port[pdev->id] = NULL; 1748 1748 1749 + out_iounmap: 1750 + iounmap(s->port.membase); 1751 + 1749 1752 out_disable_clks: 1750 1753 if (is_asm9260_auart(s)) { 1751 1754 clk_disable_unprepare(s->clk); ··· 1764 1761 uart_remove_one_port(&auart_driver, &s->port); 1765 1762 auart_port[pdev->id] = NULL; 1766 1763 mxs_auart_free_gpio_irq(s); 1764 + iounmap(s->port.membase); 1767 1765 if (is_asm9260_auart(s)) { 1768 1766 clk_disable_unprepare(s->clk); 1769 1767 clk_disable_unprepare(s->clk_ahb);