This patch prevents UART port probing when the UART port number exceeds
UART max channel numbers.
Change-Id: Ia4d0ee85fd240ec4e83107a3e67d66797e1733fd
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
if (ourport->port.line != port_index)
ourport = exynos_serial_default_port(port_index);
+ if (ourport->port.line >= CONFIG_SERIAL_SAMSUNG_UARTS) {
+ dev_err(&pdev->dev,
+ "the port %d exceeded CONFIG_SERIAL_SAMSUNG_UARTS(%d)\n"
+ , ourport->port.line, CONFIG_SERIAL_SAMSUNG_UARTS);
+ return -EINVAL;
+ }
+
ourport->drv_data = s3c24xx_get_driver_data(pdev);
if (!ourport->drv_data) {
dev_err(&pdev->dev, "could not find driver data\n");