diff --git a/cmd/gpu-kubelet-plugin/vfio-device.go b/cmd/gpu-kubelet-plugin/vfio-device.go index 54c935daa..0b3697e96 100644 --- a/cmd/gpu-kubelet-plugin/vfio-device.go +++ b/cmd/gpu-kubelet-plugin/vfio-device.go @@ -134,6 +134,14 @@ func (vm *VfioPciManager) verifyDisabledVFs(pciBusID string) error { if err != nil { return err } + if gpu == nil { + return fmt.Errorf("no GPU found at PCI bus ID %q", pciBusID) + } + // PhysicalFunction is nil for GPUs that do not support SR-IOV (e.g. T400). + // A nil PhysicalFunction means no VFs can exist, so it is safe to proceed. + if gpu.SriovInfo.PhysicalFunction == nil { + return nil + } numVFs := gpu.SriovInfo.PhysicalFunction.NumVFs if numVFs > 0 { return fmt.Errorf("gpu has %d VFs, cannot unbind", numVFs)