From 4730781712da82161e02b9c8eb43e88cd943f64e Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Sun, 28 Aug 2022 14:01:54 +0200 Subject: [PATCH] Updated LUN check --- src/raspberrypi/controllers/scsi_controller.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/raspberrypi/controllers/scsi_controller.cpp b/src/raspberrypi/controllers/scsi_controller.cpp index 79792ee78d..823dba7324 100644 --- a/src/raspberrypi/controllers/scsi_controller.cpp +++ b/src/raspberrypi/controllers/scsi_controller.cpp @@ -256,11 +256,18 @@ void ScsiController::Selection() return; } - // Abort if there is no LUN for this controller - if (ctrl.luns.empty()) { - assert(false); - return; - } + // Abort if there is no valid LUN + bool has_valid_unit = false; + for (int i = 0; i < LUN_MAX; i++) { + if (HasLunDevice(i)) { + has_valid_unit = true; + break; + } + } + if (!has_valid_unit) { + assert(false); + return; + } LOGTRACE("%s Selection Phase ID=%d (with device)", __PRETTY_FUNCTION__, (int)ctrl.scsi_id);