Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e7da053 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Greg Kroah-Hartman
Browse files

serial: amba-pl011: fix regression, causing an Oops on rmmod



A recent commit ef2889f7 "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: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9ca83fd2
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -2176,6 +2176,7 @@ 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);
@@ -2183,8 +2184,11 @@ static int pl011_remove(struct amba_device *dev)
	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);
	if (!busy)
		uart_unregister_driver(&amba_reg);
	return 0;
}