Commit 14dd1120 authored by Ke Zhang's avatar Ke Zhang Committed by openeuler-sync-bot
Browse files

serial: arc_uart: fix of_iomap leak in `arc_serial_probe`

stable inclusion
from stable-v5.10.181
commit 153017561d2804cfae87cc9aa377aa84dd906ae1
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8GJZJ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=153017561d2804cfae87cc9aa377aa84dd906ae1



--------------------------------

[ Upstream commit 8ab5fc55 ]

Smatch reports:

drivers/tty/serial/arc_uart.c:631 arc_serial_probe() warn:
'port->membase' from of_iomap() not released on lines: 631.

In arc_serial_probe(), if uart_add_one_port() fails,
port->membase is not released, which would cause a resource leak.

To fix this, I replace of_iomap with devm_platform_ioremap_resource.

Fixes: 8dbe1d5e ("serial/arc: inline the probe helper")
Signed-off-by: default avatarKe Zhang <m202171830@hust.edu.cn>
Reviewed-by: default avatarDongliang Mu <dzm91@hust.edu.cn>
Link: https://lore.kernel.org/r/20230428031636.44642-1-m202171830@hust.edu.cn


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
(cherry picked from commit 518a650d)
parent ef7dcd8b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment