git: 68091ebf0a72 - main - ufshci: report the highest LUN number in the path inquiry

From: Jaeyoon Choi <jaeyoon_at_FreeBSD.org>
Date: Tue, 18 Aug 2026 05:26:16 UTC
The branch main has been updated by jaeyoon:

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

commit 68091ebf0a72b58424e6b57d6ff9687af9043003
Author:     Jaeyoon Choi <jaeyoon@FreeBSD.org>
AuthorDate: 2026-08-18 05:09:21 +0000
Commit:     Jaeyoon Choi <jaeyoon@FreeBSD.org>
CommitDate: 2026-08-18 05:09:21 +0000

    ufshci: report the highest LUN number in the path inquiry
    
    cpi->max_lun is an inclusive upper bound, but the driver reported the
    LUN count (8 or 32), so CAM probed one nonexistent LUN past the end.
    
    Reviewed by:            imp (mentor)
    Sponsored by:           Samsung Electronics
    Differential Revision:  https://reviews.freebsd.org/D58820
---
 sys/dev/ufshci/ufshci_sim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/ufshci/ufshci_sim.c b/sys/dev/ufshci/ufshci_sim.c
index 8ac47fc4a2dc..2d9a425f6439 100644
--- a/sys/dev/ufshci/ufshci_sim.c
+++ b/sys/dev/ufshci/ufshci_sim.c
@@ -271,7 +271,7 @@ ufshci_cam_action(struct cam_sim *sim, union ccb *ccb)
 		cpi->hba_misc = need_scan_wluns | PIM_UNMAPPED | PIM_NO_6_BYTE;
 		cpi->hba_eng_cnt = 0;
 		cpi->max_target = 0;
-		cpi->max_lun = ctrlr->max_lun_count;
+		cpi->max_lun = ctrlr->max_lun_count - 1;
 		cpi->async_flags = 0;
 		cpi->maxio = ctrlr->max_xfer_size;
 		cpi->initiator_id = 1;