From f9cb932d9c74696c6e00157e89b7b13f4e985f34 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Mon, 1 Aug 2016 10:41:36 +0100 Subject: [PATCH] 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 --- devlib/module/cpuidle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devlib/module/cpuidle.py b/devlib/module/cpuidle.py index c5757aa..adf7fdc 100644 --- a/devlib/module/cpuidle.py +++ b/devlib/module/cpuidle.py @@ -113,7 +113,7 @@ class Cpuidle(Module): def get_state(self, state, cpu=0): if isinstance(state, int): try: - self.get_states(cpu)[state].enable() + return self.get_states(cpu)[state] except IndexError: raise ValueError('Cpuidle state {} does not exist'.format(state)) else: # assume string-like