diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2014-04-05 10:31:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-16 17:31:13 -0400 |
commit | 1e7da0530423a232747d64c2113ace55b01e5754 (patch) | |
tree | 1fc23712d3dc3ce9d7453ba0427f5a6075651869 /drivers/tty/serial/amba-pl011.c | |
parent | 9ca83fd2d5805a5e4608a901ffa802697adc638b (diff) |
serial: amba-pl011: fix regression, causing an Oops on rmmod
A recent commit ef2889f7ffee67f0aed49e854c72be63f1466759 "serial: pl011:
Move uart_register_driver call to device probe" introduced a regression,
causing the pl011 driver to Oops if more than 1 port have been probed. Fix
the Oops by only calling uart_unregister_driver() once after the last port
has been removed.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/amba-pl011.c')
-rw-r--r-- | drivers/tty/serial/amba-pl011.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index ca0ec600fab6..dacf0a09ab24 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -2176,6 +2176,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
2176 | static int pl011_remove(struct amba_device *dev) | 2176 | static int pl011_remove(struct amba_device *dev) |
2177 | { | 2177 | { |
2178 | struct uart_amba_port *uap = amba_get_drvdata(dev); | 2178 | struct uart_amba_port *uap = amba_get_drvdata(dev); |
2179 | bool busy = false; | ||
2179 | int i; | 2180 | int i; |
2180 | 2181 | ||
2181 | uart_remove_one_port(&amba_reg, &uap->port); | 2182 | uart_remove_one_port(&amba_reg, &uap->port); |
@@ -2183,9 +2184,12 @@ static int pl011_remove(struct amba_device *dev) | |||
2183 | for (i = 0; i < ARRAY_SIZE(amba_ports); i++) | 2184 | for (i = 0; i < ARRAY_SIZE(amba_ports); i++) |
2184 | if (amba_ports[i] == uap) | 2185 | if (amba_ports[i] == uap) |
2185 | amba_ports[i] = NULL; | 2186 | amba_ports[i] = NULL; |
2187 | else if (amba_ports[i]) | ||
2188 | busy = true; | ||
2186 | 2189 | ||
2187 | pl011_dma_remove(uap); | 2190 | pl011_dma_remove(uap); |
2188 | uart_unregister_driver(&amba_reg); | 2191 | if (!busy) |
2192 | uart_unregister_driver(&amba_reg); | ||
2189 | return 0; | 2193 | return 0; |
2190 | } | 2194 | } |
2191 | 2195 | ||