From e25719de8f8e4cd4b06d08f20d21902fcf15c8d8 Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Wed, 10 Dec 2025 09:45:07 +0000 Subject: [PATCH] Coderabbit updates --- emhttp/plugins/dynamix/include/Helpers.php | 12 +++++++++++- emhttp/plugins/dynamix/include/SysDevs.php | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix/include/Helpers.php b/emhttp/plugins/dynamix/include/Helpers.php index b02a68831..0575dd674 100644 --- a/emhttp/plugins/dynamix/include/Helpers.php +++ b/emhttp/plugins/dynamix/include/Helpers.php @@ -1022,6 +1022,11 @@ function getPciLinkInfo($pciAddress) "generation" => null, ]; + // If the device path doesn't exist, just return empty defaults + if (!is_dir($base)) { + return $out; + } + // Read speeds foreach ($files as $key => $file) { if (!file_exists($file)) continue; @@ -1063,7 +1068,12 @@ function getPciLinkInfo($pciAddress) } unset($out["max_width_raw"], $out["current_width_raw"]); // Cleanup // Downgrade flags - $class_check= strpos(trim(file_get_contents("$base/class")),"0x06",0); + if (file_exists("$base/class")) { + $class_raw = trim(file_get_contents("$base/class")); + $class_check = strpos($class_raw, "0x06", 0); + } else { + $class_check = false; + } if ($out["current_speed"] && $out["max_speed"] && $class_check === false) { $out["speed_downgraded"] = ($out["current_speed"] < $out["max_speed"]); } diff --git a/emhttp/plugins/dynamix/include/SysDevs.php b/emhttp/plugins/dynamix/include/SysDevs.php index f29a15438..8efbe306d 100644 --- a/emhttp/plugins/dynamix/include/SysDevs.php +++ b/emhttp/plugins/dynamix/include/SysDevs.php @@ -196,6 +196,9 @@ case 't1': $ackparm = ""; foreach ($lsiommu as $key => $group) { + if (empty($group)) { + continue; + } $pciidcheck = array_key_first($group); if (in_array($pciidcheck,$sriovvfs)) continue; # Filter devices.