@@ -142,6 +142,7 @@ func GetEmptyPCIeRootPorts() (int64, error) {
142142 // We check the 'class' file. PCI Bridge class code starts with 0x0604
143143 classBuf , err := os .ReadFile (filepath .Join (devPath , "class" ))
144144 if err != nil {
145+ klog .Errorf ("failed to read PCI device class %s : %v" , devPath , err )
145146 continue
146147 }
147148 class := strings .TrimSpace (string (classBuf ))
@@ -153,7 +154,10 @@ func GetEmptyPCIeRootPorts() (int64, error) {
153154 // If the bridge has children, they appear as subdirectories
154155 // matching the PCI address format (e.g., 0000:01:00.0)
155156 hasChild := false
156- files , _ := os .ReadDir (devPath )
157+ files , err2 := os .ReadDir (devPath )
158+ if err2 != nil {
159+ klog .Errorf ("failed to read dir %s : %v" , devPath , err2 )
160+ }
157161 for _ , file := range files {
158162 // PCI addresses always contain a colon
159163 if strings .Contains (file .Name (), ":" ) {
@@ -165,6 +169,8 @@ func GetEmptyPCIeRootPorts() (int64, error) {
165169 if ! hasChild {
166170 emptyCount ++
167171 }
172+ } else {
173+ klog .Infof ("skipping class %s: path: %s" , class , devPath )
168174 }
169175 }
170176
0 commit comments