git: 607189d789ac - main - ufshci: free the lookup path when the periph search times out

Jaeyoon Choi <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a7937f8.1d037.2d1616e8__40293.4420782671$1786329159$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by jaeyoon:

URL: https://cgit.FreeBSD.org/src/commit/?id=607189d789ac37fac03025cbf7dfb0d243b7c49e

commit 607189d789ac37fac03025cbf7dfb0d243b7c49e
Author:     Jaeyoon Choi <[email protected]>
AuthorDate: 2026-08-10 01:37:00 +0000
Commit:     Jaeyoon Choi <[email protected]>
CommitDate: 2026-08-10 02:28:48 +0000

    ufshci: free the lookup path when the periph search times out
    
    ufshci_sim_find_periph() freed the lookup path only when it found the
    periph. The timeout path returned without freeing it and leaked the
    path. Free the path at the single exit instead.
    
    Sponsored by:           Samsung Electronics
    Reviewed by:            imp (mentor)
    Differential Revision:  https://reviews.freebsd.org/D58657
---
 sys/dev/ufshci/ufshci_sim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/ufshci/ufshci_sim.c b/sys/dev/ufshci/ufshci_sim.c
index 234ee3bf7dfa..148840123d13 100644
--- a/sys/dev/ufshci/ufshci_sim.c
+++ b/sys/dev/ufshci/ufshci_sim.c
@@ -448,10 +448,8 @@ ufshci_sim_find_periph(struct ufshci_controller *ctrlr, uint8_t wlun)
 		periph = cam_periph_find(path, "pass");
 		xpt_path_unlock(path);
 
-		if (periph) {
-			xpt_free_path(path);
+		if (periph)
 			break;
-		}
 
 		if (timeout - ticks < 0) {
 			ufshci_printf(ctrlr,
@@ -462,6 +460,8 @@ ufshci_sim_find_periph(struct ufshci_controller *ctrlr, uint8_t wlun)
 		pause_sbt("ufshci_find_periph", ustosbt(100), 0, C_PREL(1));
 	}
 
+	xpt_free_path(path);
+
 	return periph;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.