]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fjes: Add missing iounmap in fjes_hw_init()
authorHaoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Thu, 11 Dec 2025 07:37:56 +0000 (15:37 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Mon, 22 Dec 2025 11:11:32 +0000 (12:11 +0100)
In error paths, add fjes_hw_iounmap() to release the
resource acquired by fjes_hw_iomap(). Add a goto label
to do so.

Fixes: 8cdc3f6c5d22 ("fjes: Hardware initialization routine")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Signed-off-by: Simon Horman <horms@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20251211073756.101824-1-lihaoxiang@isrc.iscas.ac.cn
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/fjes/fjes_hw.c

index b9b5554ea8620ed7249fbdc8870779c6ad658f1b..5ad2673f213d65e67071f213c54f48a31784796e 100644 (file)
@@ -334,7 +334,7 @@ int fjes_hw_init(struct fjes_hw *hw)
 
        ret = fjes_hw_reset(hw);
        if (ret)
-               return ret;
+               goto err_iounmap;
 
        fjes_hw_set_irqmask(hw, REG_ICTL_MASK_ALL, true);
 
@@ -347,8 +347,10 @@ int fjes_hw_init(struct fjes_hw *hw)
        hw->max_epid = fjes_hw_get_max_epid(hw);
        hw->my_epid = fjes_hw_get_my_epid(hw);
 
-       if ((hw->max_epid == 0) || (hw->my_epid >= hw->max_epid))
-               return -ENXIO;
+       if ((hw->max_epid == 0) || (hw->my_epid >= hw->max_epid)) {
+               ret = -ENXIO;
+               goto err_iounmap;
+       }
 
        ret = fjes_hw_setup(hw);
 
@@ -356,6 +358,10 @@ int fjes_hw_init(struct fjes_hw *hw)
        hw->hw_info.trace_size = FJES_DEBUG_BUFFER_SIZE;
 
        return ret;
+
+err_iounmap:
+       fjes_hw_iounmap(hw);
+       return ret;
 }
 
 void fjes_hw_exit(struct fjes_hw *hw)