From eed7d2798ce7b78547106d0c3557a88251b413d0 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@uranus.ravnborg.org>
Date: Fri, 25 Apr 2008 20:13:30 +0200
Subject: [PATCH] kbuild: error out on missing MODULE_LICENSE

Adrian Bunk suggested a build time check for
missing MODULE_LICENSE annotation in modules.
The build time check is fatal as we really
want this fixed for all modules.
In-tree modules should all have been fixed up by now.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Adrian Bunk <bunk@kernel.org>
---
 scripts/mod/modpost.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 110cf243fa4e5..843f6fa517cc2 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1552,6 +1552,10 @@ static void read_symbols(char *modname)
 	}
 
 	license = get_modinfo(info.modinfo, info.modinfo_len, "license");
+	if (!license && !is_vmlinux(modname))
+		fatal("modpost: missing MODULE_LICENSE() in %s\n"
+		      "see include/linux/module.h for "
+		      "more information\n", modname);
 	while (license) {
 		if (license_is_gpl_compatible(license))
 			mod->gpl_compatible = 1;
-- 
GitLab