]> git.baikalelectronics.ru Git - kernel.git/commit
serial: 8250: of: Fix mapped region size when using reg-offset property
authorRobert Hancock <robert.hancock@calian.com>
Wed, 12 Jan 2022 19:42:14 +0000 (13:42 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Jan 2022 13:50:52 +0000 (14:50 +0100)
commit19e84e7955de65e01cf29bf0addac530b8c64012
tree309085a5ba9717716276240c818b53d2a910d5e4
parent84dd2b66ad4ffb28b0b933da8584657e9ed01d1f
serial: 8250: of: Fix mapped region size when using reg-offset property

8250_of supports a reg-offset property which is intended to handle
cases where the device registers start at an offset inside the region
of memory allocated to the device. The Xilinx 16550 UART, for which this
support was initially added, requires this. However, the code did not
adjust the overall size of the mapped region accordingly, causing the
driver to request an area of memory past the end of the device's
allocation. For example, if the UART was allocated an address of
0xb0130000, size of 0x10000 and reg-offset of 0x1000 in the device
tree, the region of memory reserved was b0131000-b0140fff, which caused
the driver for the region starting at b0140000 to fail to probe.

Fix this by subtracting reg-offset from the mapped region size.

Fixes: f7e7aabbf7f7 ([POWERPC] Xilinx: of_serial support for Xilinx uart 16550.)
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Link: https://lore.kernel.org/r/20220112194214.881844-1-robert.hancock@calian.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_of.c