[igt-dev] [PATCH i-g-t] lib: Fix parse of supported suspend states

José Roberto de Souza jose.souza at intel.com
Thu Sep 10 21:09:22 UTC 2020


If /sys/power/state some day has a new state that is not in
suspend_state_name it would cause "1 << SUSPEND_STATE_NUM" bit to be
set.

Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
---
 lib/igt_aux.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index fba349334..47074c32b 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -816,9 +816,7 @@ static uint32_t get_supported_suspend_states(int power_dir)
 		for (state = SUSPEND_STATE_FREEZE; state < SUSPEND_STATE_NUM;
 		     state++)
 			if (strcmp(state_name, suspend_state_name[state]) == 0)
-				break;
-		igt_assert(state < SUSPEND_STATE_NUM);
-		state_mask |= 1 << state;
+				state_mask |= 1 << state;
 	}
 
 	free(states);
-- 
2.28.0



More information about the igt-dev mailing list