serial: amba-pl011: fix regression, causing an Oops on rmmod
PATCH 1/1 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.
--- drivers/tty/serial/amba-pl011.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/tty/serial/amba-pl011.c +5 -1
@@ -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,9 +2184,12 @@ 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); -uart_unregister_driver (&amba_reg); +if (!busy) +uart_unregister_driver (&amba_reg);return 0 ; }
Signature · 1 line
1.9.1
PATCH 1/1 serial: amba-pl011: fix regression, causing an Oops on rmmod
ROTFL. What did I say about this solution... seems I was right all along.
Quoted 45 lines · Guennadi Liakhovetski
A recent commit
ef2889f7ffee67f0aed49e854c72be63f1466759"serial: pl011:
Moveuart_register_drivercall 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 callinguart_unregister_driver()once after the last port has been removed.Signed-off-by Guennadi Liakhovetski <[email protected]>--- drivers/tty/serial/amba-pl011.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/tty/serial/amba-pl011.c +5
-1@@ -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,9 +2184,12 @@ 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); -uart_unregister_driver (&amba_reg); +if (!busy) +uart_unregister_driver (&amba_reg);return 0 ; }Signature · 7 lines
1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly improving, and getting towards what was expected from it.
PATCH 1/1 serial: amba-pl011: fix regression, causing an Oops on rmmod
In reply to Guennadi LiakhovetskiQuoted 7 lines · Guennadi Liakhovetski
A recent commit
ef2889f7ffee67f0aed49e854c72be63f1466759"serial: pl011:
Moveuart_register_drivercall 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 callinguart_unregister_driver()once after the last port has been removed.Signed-off-by Guennadi Liakhovetski <[email protected]>
Sorry about this. There were some additional suggestion in following thread [1] about registering it once during first probe and then unregistering during the last remove.
Quoted 33 lines
--- drivers/tty/serial/amba-pl011.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/tty/serial/amba-pl011.c +5
-2@@ -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,9 +2184,12 @@ 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); -uart_unregister_driver (&amba_reg); +if (!busy) +uart_unregister_driver (&amba_reg);return 0 ; } --1.9.1
Signature · 1 line
Tushar Behera