Fix some lint errors

Signed-off-by: Tuomas Katila <tuomas.katila@intel.com>
This commit is contained in:
Tuomas Katila 2024-08-19 15:26:30 +03:00 committed by Mikko Ylinen
parent a36330d810
commit fa6d027b24
2 changed files with 6 additions and 3 deletions

View File

@ -589,7 +589,7 @@ func createBypathTestFiles(t *testing.T, card, root, linkFile string, bypathFile
t.Fatal("Couldn't create test drm dir", err)
}
if err := os.WriteFile(devPath, []byte{0}, os.ModePerm); err != nil {
if err := os.WriteFile(devPath, []byte{0}, 0o600); err != nil {
t.Fatal("Couldn't create card file", err)
}
@ -604,7 +604,7 @@ func createBypathTestFiles(t *testing.T, card, root, linkFile string, bypathFile
}
for _, f := range bypathFiles {
if err := os.WriteFile(path.Join(byPath, f), []byte{1}, os.ModePerm); err != nil {
if err := os.WriteFile(path.Join(byPath, f), []byte{1}, 0o600); err != nil {
t.Fatal("WriteFile failed:", path.Join(byPath, f))
}
}

View File

@ -39,7 +39,10 @@ func getFakeDevNodes(devDir, charDevDir, wqName string) ([]pluginapi.DeviceSpec,
var devNum, queueNum int
fmt.Sscanf(wqName, "wq%d.%d", &devNum, &queueNum)
if _, err := fmt.Sscanf(wqName, "wq%d.%d", &devNum, &queueNum); err != nil {
return []pluginapi.DeviceSpec{}, err
}
charDevPath := path.Join(charDevDir, fmt.Sprintf("%d:%d", dsaMajor, devNum*10+queueNum))
return []pluginapi.DeviceSpec{