Skip to content

Commit 7d333b7

Browse files
committed
Fix some lint errors
Signed-off-by: Tuomas Katila <[email protected]>
1 parent 0aa391c commit 7d333b7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cmd/gpu_plugin/gpu_plugin_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ func createBypathTestFiles(t *testing.T, card, root, linkFile string, bypathFile
589589
t.Fatal("Couldn't create test drm dir", err)
590590
}
591591

592-
if err := os.WriteFile(devPath, []byte{0}, os.ModePerm); err != nil {
592+
if err := os.WriteFile(devPath, []byte{0}, 0o600); err != nil {
593593
t.Fatal("Couldn't create card file", err)
594594
}
595595

@@ -604,7 +604,7 @@ func createBypathTestFiles(t *testing.T, card, root, linkFile string, bypathFile
604604
}
605605

606606
for _, f := range bypathFiles {
607-
if err := os.WriteFile(path.Join(byPath, f), []byte{1}, os.ModePerm); err != nil {
607+
if err := os.WriteFile(path.Join(byPath, f), []byte{1}, 0o600); err != nil {
608608
t.Fatal("WriteFile failed:", path.Join(byPath, f))
609609
}
610610
}

pkg/idxd/plugin_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ func getFakeDevNodes(devDir, charDevDir, wqName string) ([]pluginapi.DeviceSpec,
3939

4040
var devNum, queueNum int
4141

42-
fmt.Sscanf(wqName, "wq%d.%d", &devNum, &queueNum)
42+
if _, err := fmt.Sscanf(wqName, "wq%d.%d", &devNum, &queueNum); err != nil {
43+
return []pluginapi.DeviceSpec{}, err
44+
}
45+
4346
charDevPath := path.Join(charDevDir, fmt.Sprintf("%d:%d", dsaMajor, devNum*10+queueNum))
4447

4548
return []pluginapi.DeviceSpec{

0 commit comments

Comments
 (0)