Commit 39be40ce authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Greg Kroah-Hartman

serial: 8250_uniphier: fix serial port index in private data

serial8250_register_8250_port() may allocate a different port index
than requested.  The driver needs to remember the returned value of
serial8250_register_8250_port() for later use.  Otherwise, the .remove
hook may unregister a different port.

Fixes: 1a8d2903 ("serial: 8250_uniphier: add UniPhier serial driver")
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1c16ae65
...@@ -169,7 +169,7 @@ static int uniphier_of_serial_setup(struct device *dev, struct uart_port *port, ...@@ -169,7 +169,7 @@ static int uniphier_of_serial_setup(struct device *dev, struct uart_port *port,
dev_err(dev, "failed to get alias id\n"); dev_err(dev, "failed to get alias id\n");
return ret; return ret;
} }
port->line = priv->line = ret; port->line = ret;
/* Get clk rate through clk driver */ /* Get clk rate through clk driver */
priv->clk = devm_clk_get(dev, NULL); priv->clk = devm_clk_get(dev, NULL);
...@@ -249,8 +249,8 @@ static int uniphier_uart_probe(struct platform_device *pdev) ...@@ -249,8 +249,8 @@ static int uniphier_uart_probe(struct platform_device *pdev)
up.dl_read = uniphier_serial_dl_read; up.dl_read = uniphier_serial_dl_read;
up.dl_write = uniphier_serial_dl_write; up.dl_write = uniphier_serial_dl_write;
ret = serial8250_register_8250_port(&up); priv->line = serial8250_register_8250_port(&up);
if (ret < 0) { if (priv->line < 0) {
dev_err(dev, "failed to register 8250 port\n"); dev_err(dev, "failed to register 8250 port\n");
clk_disable_unprepare(priv->clk); clk_disable_unprepare(priv->clk);
return ret; return ret;
......
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