[Intel-gfx] [PATCH i-g-t] lib: Fix igt_sysfs_set_u32 return value

Tvrtko Ursulin tursulin at ursulin.net
Fri Sep 29 11:29:49 UTC 2017


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Printf family functions return a number of bytes, not tokens,
printed so the existing check (== 1) was wrong.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 lib/igt_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 817678bc28ed..6f03008b14a5 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -463,7 +463,7 @@ uint32_t igt_sysfs_get_u32(int dir, const char *attr)
  */
 bool igt_sysfs_set_u32(int dir, const char *attr, uint32_t value)
 {
-	return igt_sysfs_printf(dir, attr, "%u", value) == 1;
+	return igt_sysfs_printf(dir, attr, "%u", value) > 0;
 }
 
 /**
-- 
2.9.5



More information about the Intel-gfx mailing list