diff mbox series

[-v2,2/7] module/modpost: Use for() loop

Message ID 20241202150810.160972089@infradead.org (mailing list archive)
State New
Headers show
Series module: Strict per-modname namespaces | expand

Commit Message

Peter Zijlstra Dec. 2, 2024, 2:59 p.m. UTC
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 scripts/mod/modpost.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Masahiro Yamada Feb. 7, 2025, 8:50 a.m. UTC | #1
On Tue, Dec 3, 2024 at 12:11 AM Peter Zijlstra <peterz@infradead.org> wrote:


Please add a commit description.


>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  scripts/mod/modpost.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1586,12 +1586,9 @@ static void read_symbols(const char *mod
>                         license = get_next_modinfo(&info, "license", license);
>                 }
>
> -               namespace = get_modinfo(&info, "import_ns");
> -               while (namespace) {
> +               for (namespace = get_modinfo(&info, "import_ns"); namespace;
> +                    namespace = get_next_modinfo(&info, "import_ns", namespace))


[Bikeshed]

Personally, I tend to indent a long for() as follows:


 for (namespace = get_modinfo(&info, "import_ns");
     namespace;
     namespace = get_next_modinfo(&info, "import_ns", namespace))



>                         add_namespace(&mod->imported_namespaces, namespace);
> -                       namespace = get_next_modinfo(&info, "import_ns",
> -                                                    namespace);
> -               }
>
>                 if (extra_warn && !get_modinfo(&info, "description"))
>                         warn("missing MODULE_DESCRIPTION() in %s\n", modname);
>
>
Masahiro Yamada Feb. 7, 2025, 4:38 p.m. UTC | #2
The commit subject prefix should be "modpost: "
instead of "module/modpost: "

You are touching only modpost in this patch.


On Tue, Dec 3, 2024 at 12:11 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  scripts/mod/modpost.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
--
Best Regards
Masahiro Yamada
diff mbox series

Patch

--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1586,12 +1586,9 @@  static void read_symbols(const char *mod
 			license = get_next_modinfo(&info, "license", license);
 		}
 
-		namespace = get_modinfo(&info, "import_ns");
-		while (namespace) {
+		for (namespace = get_modinfo(&info, "import_ns"); namespace;
+		     namespace = get_next_modinfo(&info, "import_ns", namespace))
 			add_namespace(&mod->imported_namespaces, namespace);
-			namespace = get_next_modinfo(&info, "import_ns",
-						     namespace);
-		}
 
 		if (extra_warn && !get_modinfo(&info, "description"))
 			warn("missing MODULE_DESCRIPTION() in %s\n", modname);