diff --git a/sys/dev/ufshci/ufshci_sim.c b/sys/dev/ufshci/ufshci_sim.c --- a/sys/dev/ufshci/ufshci_sim.c +++ b/sys/dev/ufshci/ufshci_sim.c @@ -448,10 +448,8 @@ 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 @@ pause_sbt("ufshci_find_periph", ustosbt(100), 0, C_PREL(1)); } + xpt_free_path(path); + return periph; }