* [PATCH 0/2] dyndbg: fix incorrect mod_ct value in dynamic_debug_init()
@ 2026-08-11 12:18 Yuntao Wang
2026-08-11 12:18 ` [PATCH 1/2] " Yuntao Wang
2026-08-11 12:18 ` [PATCH 2/2] dyndbg: clean up dynamic_debug_init() to improve readability Yuntao Wang
0 siblings, 2 replies; 3+ messages in thread
From: Yuntao Wang @ 2026-08-11 12:18 UTC (permalink / raw)
To: Jason Baron, Jim Cromie; +Cc: Andrew Morton, linux-kernel, Yuntao Wang
Fix and clean up the dynamic_debug_init() function.
Yuntao Wang (2):
dyndbg: fix incorrect mod_ct value in dynamic_debug_init()
dyndbg: clean up dynamic_debug_init() to improve readability
lib/dynamic_debug.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] dyndbg: fix incorrect mod_ct value in dynamic_debug_init()
2026-08-11 12:18 [PATCH 0/2] dyndbg: fix incorrect mod_ct value in dynamic_debug_init() Yuntao Wang
@ 2026-08-11 12:18 ` Yuntao Wang
2026-08-11 12:18 ` [PATCH 2/2] dyndbg: clean up dynamic_debug_init() to improve readability Yuntao Wang
1 sibling, 0 replies; 3+ messages in thread
From: Yuntao Wang @ 2026-08-11 12:18 UTC (permalink / raw)
To: Jason Baron, Jim Cromie; +Cc: Andrew Morton, linux-kernel, Yuntao Wang
Suppose all `struct _ddebug` instances belong to the same module, mod_ct
should be 1, but it is currently 0.
Fix it.
Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
---
lib/dynamic_debug.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 18a71a9108d3..16fad5454d6a 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1456,6 +1456,8 @@ static int __init dynamic_debug_init(void)
iter_mod_start = iter;
}
}
+
+ mod_ct++;
di.num_descs = mod_sites;
di.descs = iter_mod_start;
ret = ddebug_add_module(&di, modname);
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] dyndbg: clean up dynamic_debug_init() to improve readability
2026-08-11 12:18 [PATCH 0/2] dyndbg: fix incorrect mod_ct value in dynamic_debug_init() Yuntao Wang
2026-08-11 12:18 ` [PATCH 1/2] " Yuntao Wang
@ 2026-08-11 12:18 ` Yuntao Wang
1 sibling, 0 replies; 3+ messages in thread
From: Yuntao Wang @ 2026-08-11 12:18 UTC (permalink / raw)
To: Jason Baron, Jim Cromie; +Cc: Andrew Morton, linux-kernel, Yuntao Wang
Keep variable assignments in the same order throughout the function to
make the code easier to follow.
No functional changes.
Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
---
lib/dynamic_debug.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 16fad5454d6a..49334d1aa4b3 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1442,28 +1442,29 @@ static int __init dynamic_debug_init(void)
i = mod_sites = mod_ct = 0;
for (; iter < __stop___dyndbg; iter++, i++, mod_sites++) {
-
if (strcmp(modname, iter->modname)) {
- mod_ct++;
- di.num_descs = mod_sites;
di.descs = iter_mod_start;
+ di.num_descs = mod_sites;
ret = ddebug_add_module(&di, modname);
if (ret)
goto out_err;
- mod_sites = 0;
- modname = iter->modname;
+ mod_ct++;
+
iter_mod_start = iter;
+ modname = iter->modname;
+ mod_sites = 0;
}
}
- mod_ct++;
- di.num_descs = mod_sites;
di.descs = iter_mod_start;
+ di.num_descs = mod_sites;
ret = ddebug_add_module(&di, modname);
if (ret)
goto out_err;
+ mod_ct++;
+
ddebug_init_success = 1;
vpr_info("%d prdebugs in %d modules, %d KiB in ddebug tables, %d kiB in __dyndbg section\n",
i, mod_ct, (int)((mod_ct * sizeof(struct ddebug_table)) >> 10),
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-11 12:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11 12:18 [PATCH 0/2] dyndbg: fix incorrect mod_ct value in dynamic_debug_init() Yuntao Wang
2026-08-11 12:18 ` [PATCH 1/2] " Yuntao Wang
2026-08-11 12:18 ` [PATCH 2/2] dyndbg: clean up dynamic_debug_init() to improve readability Yuntao Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox