Skip to content

Commit

Permalink
Fix runtime error when there are no NVM devices.
Browse files Browse the repository at this point in the history
Signed-off-by: Paweł Szulik <pawel.szulik@intel.com>
  • Loading branch information
Paweł Szulik committed Sep 21, 2020
1 parent f17af50 commit 05812f0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nvm/machine_libipmctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ func getAvgPowerBudget() (uint, error) {
return uint(0), fmt.Errorf("Unable to get number of NVM devices. Status code: %d", err)
}

if count == 0 {
klog.Warningf("There are no NVM devices!")
return uint(0), nil
}

// Load basic device information for all the devices
// to obtain UID of the first one.
devices := make([]C.struct_device_discovery, count)
Expand Down

0 comments on commit 05812f0

Please sign in to comment.