[PATCH] serial: sh-sci: fix memory region release in error path

zenghongling posted 1 patch 2 months ago
There is a newer version of this series
drivers/tty/serial/sh-sci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] serial: sh-sci: fix memory region release in error path
Posted by zenghongling 2 months ago
The sci_request_port() function uses request_mem_region() to reserve
I/O memory, but in the error path when sci_remap_port() fails, it
incorrectly calls release_resource() instead of release_mem_region().

This mismatch can cause resource accounting issues. Fix it by using
the correct release function, consistent with sci_release_port().

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: zenghongling <zenghongling@kylinos.cn>
---
 drivers/tty/serial/sh-sci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index bd7486315338..9e619db27237 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -3024,7 +3024,7 @@ int sci_request_port(struct uart_port *port)
 
 	ret = sci_remap_port(port);
 	if (unlikely(ret != 0)) {
-		release_resource(res);
+		release_mem_region(port->mapbase, sport->reg_size);
 		return ret;
 	}
 
-- 
2.25.1
Re: [PATCH] serial: sh-sci: fix memory region release in error path
Posted by Greg KH 2 months ago
On Fri, Apr 10, 2026 at 05:21:43PM +0800, zenghongling wrote:
> The sci_request_port() function uses request_mem_region() to reserve
> I/O memory, but in the error path when sci_remap_port() fails, it
> incorrectly calls release_resource() instead of release_mem_region().
> 
> This mismatch can cause resource accounting issues. Fix it by using
> the correct release function, consistent with sci_release_port().
> 
> Reported-by: kernel test robot <lkp@intel.com>

The kernel test robot reported this?  Where is that report?

> Signed-off-by: zenghongling <zenghongling@kylinos.cn>

Can you use your name please, not your email alias.

thanks,

greg k-h