[PATCH i-g-t] runner/kmemleak: Remove unnecessary lseek() calls
Peter Senna Tschudin
peter.senna at linux.intel.com
Mon Mar 10 20:02:20 UTC 2025
Earlier versions of the code performed multiple read operations on the
kmemleak file without closing and reopening the file descriptor. To
handle this, lseek() was used to reset the read position.
However, the current implementation no longer requires these lseek()
calls, as the redundant read operations have been removed. This commit
eliminates the leftover lseek() calls that are now unnecessary.
Cc: vitaly.prosyak at amd.com
Cc: christian.koenig at amd.com
Cc: alexander.deucher at amd.com
Cc: jesse.zhang at amd.com
Cc: harry.wentland at amd.com
Cc: zbigniew.kempczynski at intel.com
Cc: kamil.konieczny at linux.intel.com
Cc: ryszard.knop at intel.com
Cc: lucas.demarchi at intel.com
Cc: katarzyna.piecielska at intel.com
Signed-off-by: Peter Senna Tschudin <peter.senna at linux.intel.com>
---
runner/kmemleak.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/runner/kmemleak.c b/runner/kmemleak.c
index e1bfb65ba..e52bc12d5 100644
--- a/runner/kmemleak.c
+++ b/runner/kmemleak.c
@@ -116,9 +116,6 @@ static bool runner_kmemleak_found_leaks(void)
rlen = read(fd, buf, 1);
- if (rlen == 1)
- lseek(fd, 0, SEEK_SET);
-
close(fd);
return rlen == 1;
@@ -169,12 +166,6 @@ static bool runner_kmemleak_append_to(const char *last_test, int resdirfd,
if (kmemleakfd < 0)
return false;
- /* Seek back to first byte */
- if (lseek(kmemleakfd, 0, SEEK_SET) == (off_t)-1) {
- close(kmemleakfd);
- return false;
- }
-
/* Open text file to append */
resfilefd = openat(resdirfd, KMEMLEAK_RESFILENAME,
O_RDWR | O_CREAT | O_APPEND, 0666);
--
2.34.1
More information about the igt-dev
mailing list