[PATCH v1 1/2] perf tests: Assign return value of ioctl in wp_modify test

From: Tiezhu Yang

Date: Fri Nov 06 2026 - 04:28:27 EST


In test__wp_modify(), the return value of ioctl PERF_EVENT_IOC_ENABLE
was not being captured. As a result, the subsequent error handling was
checking a stalled value of `ret` instead of the actual result of the
enablement operation.

Fix this by properly assigning the return value of the ioctl call to
`ret` so that the test can correctly catch and report failures when
enabling the watchpoint event.

Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
---
tools/perf/tests/wp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/wp.c b/tools/perf/tests/wp.c
index 69b31f00eed0..f0b829b82f2b 100644
--- a/tools/perf/tests/wp.c
+++ b/tools/perf/tests/wp.c
@@ -182,7 +182,7 @@ static int test__wp_modify(struct test_suite *test __maybe_unused, int subtest _
WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 1);

/* Enable the event */
- ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
+ ret = ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
if (ret < 0) {
pr_debug("Failed to enable event\n");
close(fd);
--
2.42.0