From: Shekhar Chauhan <shekhar.chauhan@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: shekhar.chauhan@intel.com, ashutosh.dixit@intel.com
Subject: [PATCH v1 1/1] lib/intel_wa: Assert on error instead of returning -1
Date: Wed, 13 May 2026 10:06:27 +0530 [thread overview]
Message-ID: <20260513043629.1533907-2-shekhar.chauhan@intel.com> (raw)
In-Reply-To: <20260513043629.1533907-1-shekhar.chauhan@intel.com>
igt_has_intel_wa() returns 0, 1, or -1, but there is no point
distinguishing the error and no-workaround cases for callers. Replace
the error return with igt_assert() and simplify debugfs_file_has_wa() by
dropping the igt_debugfs_exists() check, since igt_sysfs_get() returns
NULL for missing files anyway.
Signed-off-by: Shekhar Chauhan <shekhar.chauhan@intel.com>
---
lib/intel_wa.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/lib/intel_wa.c b/lib/intel_wa.c
index 727dd6c98..5d50dcc28 100644
--- a/lib/intel_wa.c
+++ b/lib/intel_wa.c
@@ -7,6 +7,7 @@
#include <stdint.h>
#include <stdio.h>
+#include "igt_core.h"
#include "igt_debugfs.h"
#include "igt_sysfs.h"
#include "intel_wa.h"
@@ -17,9 +18,6 @@ static int debugfs_file_has_wa(int drm_fd, int debugfs_fd,
{
char *debugfs_dump;
- if (!igt_debugfs_exists(drm_fd, debugfs_name, O_RDONLY))
- return -1;
-
debugfs_dump = igt_sysfs_get(debugfs_fd, debugfs_name);
if (debugfs_dump) {
char *has_wa = strstr(debugfs_dump, wa);
@@ -38,7 +36,7 @@ static int debugfs_file_has_wa(int drm_fd, int debugfs_fd,
* @drm_fd: A drm file descriptor
* @check_wa: Workaround to be checked
*
- * Returns: 0 if no WA, 1 if WA present, -1 on error
+ * Returns: 1 if WA present, 0 otherwise
*/
int igt_has_intel_wa(int drm_fd, const char *check_wa)
{
@@ -48,8 +46,7 @@ int igt_has_intel_wa(int drm_fd, const char *check_wa)
char name[256];
debugfs_fd = igt_debugfs_dir(drm_fd);
- if (debugfs_fd == -1)
- return -1;
+ igt_assert(debugfs_fd >= 0);
xe_for_each_gt(drm_fd, xe) {
sprintf(name, "gt%d/workarounds", xe);
@@ -58,7 +55,7 @@ int igt_has_intel_wa(int drm_fd, const char *check_wa)
break;
}
- if (!ret)
+ if (!ret && igt_debugfs_exists(drm_fd, "workarounds", O_RDONLY))
ret = debugfs_file_has_wa(drm_fd, debugfs_fd, "workarounds", check_wa);
close(debugfs_fd);
--
2.53.0
next prev parent reply other threads:[~2026-05-13 4:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 4:36 [PATCH v1 0/1] Fix assert vs error in lib/intel_wa Shekhar Chauhan
2026-05-13 4:36 ` Shekhar Chauhan [this message]
2026-05-13 6:41 ` [PATCH v1 1/1] lib/intel_wa: Assert on error instead of returning -1 Dixit, Ashutosh
2026-05-13 21:30 ` Dixit, Ashutosh
2026-05-13 5:50 ` ✗ i915.CI.BAT: failure for Fix assert vs error in lib/intel_wa Patchwork
2026-05-13 5:50 ` Patchwork
2026-05-13 6:00 ` ✓ Xe.CI.BAT: success " Patchwork
2026-05-14 2:24 ` ✗ Xe.CI.FULL: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260513043629.1533907-2-shekhar.chauhan@intel.com \
--to=shekhar.chauhan@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox