[igt-dev] [PATCH i-g-t] lib/igt_sysfs: Return errno from igt_sysfs_printf
Katarzyna Dec
katarzyna.dec at intel.com
Wed Aug 29 13:13:49 UTC 2018
Let's add returning errno on failure instead of -1.
Signed-off-by: Katarzyna Dec <katarzyna.dec at intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
---
lib/igt_sysfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 8efe889b..6cc7ba44 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -417,7 +417,7 @@ int igt_sysfs_vprintf(int dir, const char *attr, const char *fmt, va_list ap)
* printf() wrapper for sysfs.
*
* Returns:
- * Number of characters written, negative value on error.
+ * Number of characters written, errno on error.
*/
int igt_sysfs_printf(int dir, const char *attr, const char *fmt, ...)
{
@@ -427,6 +427,8 @@ int igt_sysfs_printf(int dir, const char *attr, const char *fmt, ...)
va_start(ap, fmt);
ret = igt_sysfs_vprintf(dir, attr, fmt, ap);
va_end(ap);
+ if (ret < 0)
+ return errno;
return ret;
}
--
2.17.1
More information about the igt-dev
mailing list