]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
serial: sh-sci: fix memory region release in error path
authorHongling Zeng <zenghongling@kylinos.cn>
Tue, 21 Apr 2026 06:57:37 +0000 (14:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 11 May 2026 15:02:32 +0000 (17:02 +0200)
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().

Fixes: e2651647080930a1 ("serial: sh-sci: Handle port memory region reservations.")
Cc: stable <stable@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202604032356.SzEjYkBC-lkp@intel.com/
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20260421065737.724187-1-zenghongling@kylinos.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c

index 6c819b6b24258d369a13fcaf2781155b1283c280..54db019a5bfcd66585743d04931e72bbc297be27 100644 (file)
@@ -3025,7 +3025,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;
        }