Thread (5 messages) 5 messages, 3 authors, 2021-11-26

Re: [PATCH] serial: amba-pl011: do not request memory region twice

From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2021-11-26 16:16:42
Also in: lkml

On Fri, Nov 26, 2021 at 03:39:25PM +0100, Lino Sanfilippo wrote:
The driver attempts to request and release the IO memory region for a uart
port twice:

First during the probe() function devm_ioremap_resource() is used to
allocate and map the ports memory.
Then a combo of pl011_config_port() and pl011_release_port() is used to
request/release the same memory area. These functions are called by the
serial core as soon as the uart is registered/unregistered.

However since the allocation request via devm_ioremap_resource() already
succeeds, the attempt to claim the memory again via pl011_config_port()
fails. This failure remains unnoticed, since the concerning return value is
not evaluated.
Later at module unload also the attempt to release the unclaimed memory
in pl011_release_port() fails. This time the failure results in a “Trying
to free nonexistent resource" warning printed by the serial core.

Fix these issues by removing the callbacks that implement the redundant
memory allocation/release.
I think you will also need the verify_port method to also deny changing
port->mapbase.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help