git: ad33bd6f67a9 - stable/15 - ufshci: free the lookup path when the periph search times out

From: Jaeyoon Choi <jaeyoon_at_FreeBSD.org>
Date: Tue, 06 Oct 2026 07:51:05 UTC
The branch stable/15 has been updated by jaeyoon:

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

commit ad33bd6f67a906e26e96aaf7cfb3448038bc9647
Author:     Jaeyoon Choi <jaeyoon@FreeBSD.org>
AuthorDate: 2026-08-10 01:37:00 +0000
Commit:     Jaeyoon Choi <jaeyoon@FreeBSD.org>
CommitDate: 2026-10-06 06:27:55 +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
    
    (cherry picked from commit 607189d789ac37fac03025cbf7dfb0d243b7c49e)
---
 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;
 }