Skip to content

Commit

Permalink
serial: amba-pl011: fix regression, causing an Oops on rmmod
Browse files Browse the repository at this point in the history
A recent commit ef2889f "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>
  • Loading branch information
Guennadi Liakhovetski authored and Greg Kroah-Hartman committed Apr 16, 2014
1 parent 9ca83fd commit 1e7da05
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/tty/serial/amba-pl011.c
Original file line number Diff line number Diff line change
Expand Up @@ -2176,16 +2176,20 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
static int pl011_remove(struct amba_device *dev)
{
struct uart_amba_port *uap = amba_get_drvdata(dev);
bool busy = false;
int i;

uart_remove_one_port(&amba_reg, &uap->port);

for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
if (amba_ports[i] == uap)
amba_ports[i] = NULL;
else if (amba_ports[i])
busy = true;

pl011_dma_remove(uap);
uart_unregister_driver(&amba_reg);
if (!busy)
uart_unregister_driver(&amba_reg);
return 0;
}

Expand Down

0 comments on commit 1e7da05

Please sign in to comment.