summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Zhang <dingchen.zhang@amd.com>2022-04-06 15:14:59 -0400
committerRodrigo Siqueira <Rodrigo.Siqueira@amd.com>2022-04-06 17:25:50 -0400
commit7a1456b87a3f089e1c211974ce9e9fdd5172f3ac (patch)
tree27178031b84eb6ab6578a14c993ecbe85b938837 /lib
parentb4d8d30a4ec8dae5c1c403f41348c073a9591d9f (diff)
lib/igt_amd: return negative if PSR state debugfs open fails
[why & how] The PSR state read helper should return an integer which is not the same as PSR state enumeration item for the case of debugfs interface opening fail. Currently it return false which is casted to 0 that is the same as PSR_STATE0, this is incorrect. Instead of returning 0, a negative (e.g. -1) value is returned when debugfs interface of PSR state opening fails. And adding the check of such negative value in amd_psr test case as well. Cc: Rodrigo Siqueira <rodrigo.siqueira@amd.com> Cc: Harry Wentland <harry.wentland@amd.com> Cc: Leo Li <sunpeng.li@amd.com> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com> Cc: Wayne Lin <wayne.lin@amd.com> Signed-off-by: David Zhang <dingchen.zhang@amd.com> Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_amd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/igt_amd.c b/lib/igt_amd.c
index f6ca2237..bef9c193 100644
--- a/lib/igt_amd.c
+++ b/lib/igt_amd.c
@@ -1097,7 +1097,7 @@ int igt_amd_read_psr_state(int drm_fd, char *connector_name)
fd = igt_debugfs_connector_dir(drm_fd, connector_name, O_RDONLY);
if (fd < 0) {
igt_info("Couldn't open connector %s debugfs directory\n", connector_name);
- return false;
+ return -1;
}
ret = igt_debugfs_simple_read(fd, DEBUGFS_EDP_PSR_STATE, buf, sizeof(buf));