The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Yuntao Wang <yuntao.wang@linux.dev>
To: Jason Baron <jbaron@akamai.com>, Jim Cromie <jim.cromie@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Yuntao Wang <yuntao.wang@linux.dev>
Subject: [PATCH 2/2] dyndbg: clean up dynamic_debug_init() to improve readability
Date: Tue, 11 Aug 2026 20:18:31 +0800	[thread overview]
Message-ID: <20260811121831.577848-3-yuntao.wang@linux.dev> (raw)
In-Reply-To: <20260811121831.577848-1-yuntao.wang@linux.dev>

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


      parent reply	other threads:[~2026-08-11 12:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260811121831.577848-3-yuntao.wang@linux.dev \
    --to=yuntao.wang@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=jbaron@akamai.com \
    --cc=jim.cromie@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox