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

From: Jaeyoon Choi <jaeyoon_at_FreeBSD.org>
Date: Mon, 10 Aug 2026 02:31:20 UTC
The branch main has been updated by jaeyoon:

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

commit 607189d789ac37fac03025cbf7dfb0d243b7c49e
Author:     Jaeyoon Choi <jaeyoon@FreeBSD.org>
AuthorDate: 2026-08-10 01:37:00 +0000
Commit:     Jaeyoon Choi <jaeyoon@FreeBSD.org>
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;
 }