1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 10:10:46 +00:00

cgroups: fix get_states() return value when passing integer state

When passing an idle state ID to get_states(), nothing is returned. Also, there
is a wrong call to enable() in the method.

Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com>
This commit is contained in:
Michele Di Giorgio 2016-08-01 10:41:36 +01:00
parent 0c8f26763b
commit f9cb932d9c

View File

@ -113,7 +113,7 @@ class Cpuidle(Module):
def get_state(self, state, cpu=0): def get_state(self, state, cpu=0):
if isinstance(state, int): if isinstance(state, int):
try: try:
self.get_states(cpu)[state].enable() return self.get_states(cpu)[state]
except IndexError: except IndexError:
raise ValueError('Cpuidle state {} does not exist'.format(state)) raise ValueError('Cpuidle state {} does not exist'.format(state))
else: # assume string-like else: # assume string-like