On 7/10/24 00:30, Zhu Jun wrote:
The opened file should be closed in main(), otherwise resource
leak will occur that this problem was discovered by reading code
Signed-off-by: Zhu Jun <zhujun2@xxxxxxxxxxxxxxxxxxxx>
---
tools/testing/selftests/dma/dma_map_benchmark.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/dma/dma_map_benchmark.c b/tools/testing/selftests/dma/dma_map_benchmark.c
index 5c997f17fcbd..3fcea00961c0 100644
--- a/tools/testing/selftests/dma/dma_map_benchmark.c
+++ b/tools/testing/selftests/dma/dma_map_benchmark.c
@@ -114,6 +114,7 @@ int main(int argc, char **argv)
map.granule = granule;
if (ioctl(fd, cmd, &map)) {
+ close(fd);
perror("ioctl");
exit(1);
}
@@ -125,5 +126,7 @@ int main(int argc, char **argv)
printf("average unmap latency(us):%.1f standard deviation:%.1f\n",
map.avg_unmap_100ns/10.0, map.unmap_stddev/10.0);
+ close(fd);
+
return 0;
}
Files get closed when this process exits. There is no need
to make this change.
thanks,
-- Shuah