Merge branch 'fix-pci-id-case' into 'main'

Ensure pci bus ID is lower case

See merge request nvidia/cloud-native/go-nvlib!25
This commit is contained in:
Evan Lezar 2022-11-16 11:13:58 +00:00
commit 0e10f084d1

View File

@ -224,7 +224,7 @@ func (d *device) getClass() (Class, error) {
}
bytes = append(bytes, byte(b))
}
id := string(bytes)
id := strings.ToLower(string(bytes))
if id != "0000" {
id = strings.TrimPrefix(id, "0000")
@ -232,7 +232,7 @@ func (d *device) getClass() (Class, error) {
device, err := nvpci.New().GetGPUByPciBusID(id)
if err != nil {
return 0, fmt.Errorf("failed to construct PCI device: %v", ret)
return 0, fmt.Errorf("failed to construct PCI device: %v", err)
}
return Class(device.Class), nil