Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH 1/2] gputop: fix region array max iteration index loop bug
@ 2023-08-08 21:03 Adrián Larumbe
  2023-08-08 21:03 ` [igt-dev] [PATCH 2/2] lib/igt_drm_fdinfo.c: refactor region array population code Adrián Larumbe
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Adrián Larumbe @ 2023-08-08 21:03 UTC (permalink / raw)
  To: tvrtko.ursulin, robdclark, kamil.konieczny, igt-dev
  Cc: adrian.larumbe, kernel

If c->regions->num_regions equals 1, then c->regions->max_region_id equals
0, so neither of the cumulative memory region size loops will be executed.
Fix it by adjusting loop termination condition.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
---
 tools/gputop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/gputop.c b/tools/gputop.c
index ac106abea2ee..ea95e0333dd2 100644
--- a/tools/gputop.c
+++ b/tools/gputop.c
@@ -166,11 +166,11 @@ print_client(struct igt_drm_client *c, struct igt_drm_client **prevc,
 	len = printf("%*s ", c->clients->max_pid_len, c->pid_str);
 
 	if (c->regions->num_regions) {
-		for (sz = 0, i = 0; i < c->regions->max_region_id; i++)
+		for (sz = 0, i = 0; i <= c->regions->max_region_id; i++)
 			sz += c->memory[i].total;
 		len += print_size(sz);
 
-		for (sz = 0, i = 0; i < c->regions->max_region_id; i++)
+		for (sz = 0, i = 0; i <= c->regions->max_region_id; i++)
 			sz += c->memory[i].resident;
 		len += print_size(sz);
 	}
-- 
2.41.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-08-11  9:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08 21:03 [igt-dev] [PATCH 1/2] gputop: fix region array max iteration index loop bug Adrián Larumbe
2023-08-08 21:03 ` [igt-dev] [PATCH 2/2] lib/igt_drm_fdinfo.c: refactor region array population code Adrián Larumbe
2023-08-09 11:31   ` Kamil Konieczny
2023-08-09 14:17     ` Sharma, Swati2
2023-08-08 22:42 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/2] gputop: fix region array max iteration index loop bug Patchwork
2023-08-09  1:56 ` [igt-dev] ○ CI.xeBAT: info " Patchwork
2023-08-09 11:08 ` [igt-dev] [PATCH 1/2] " Kamil Konieczny
2023-08-09 11:15 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [1/2] " Patchwork
2023-08-10 19:18   ` Kamil Konieczny
2023-08-11  9:23     ` Yedireswarapu, SaiX Nandan
2023-08-11  6:55 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox