Changeset 469c1c9eb6c9 ("kernel-doc: Issue warnings that were silently discarded")
didn't properly addressed the missing messages behavior, as
it was calling directly python logger low-level function,
instead of using the expected method to emit warnings.
Basically, there are two methods to log messages:
- self.config.log.warning() - This is the raw level to emit a
warning. It just writes the a message at stderr, via python
logging, as it is initialized as:
self.config.log = logging.getLogger("kernel-doc")
- self.config.warning() - This is where we actually consider a
message as a warning, properly incrementing error count.
Due to that, several parsing error messages are internally considered
as success, causing -Werror to not work on such messages.
While here, ensure that the last ignored entry will also be handled
by adding an extra check at the end of the parse handler.
Fixes: 469c1c9eb6c9 ("kernel-doc: Issue warnings that were silently discarded")
Closes: https://lore.kernel.org/linux-doc/20260112091053.00cee29a@foz.lan/
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
tools/lib/python/kdoc/kdoc_parser.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/lib/python/kdoc/kdoc_parser.py b/tools/lib/python/kdoc/kdoc_parser.py
index a9a37519145d..aed07fdaa561 100644
--- a/tools/lib/python/kdoc/kdoc_parser.py
+++ b/tools/lib/python/kdoc/kdoc_parser.py
@@ -459,7 +459,7 @@ class KernelDoc:
#
if self.entry and self.entry not in self.entries:
for log_msg in self.entry.warnings:
- self.config.log.warning(log_msg)
+ self.config.warning(log_msg)
self.entry = KernelEntry(self.config, self.fname, ln)
@@ -1741,6 +1741,10 @@ class KernelDoc:
# Hand this line to the appropriate state handler
self.state_actions[self.state](self, ln, line)
+ if self.entry and self.entry not in self.entries:
+ for log_msg in self.entry.warnings:
+ self.config.warning(log_msg)
+
except OSError:
self.config.log.error(f"Error: Cannot open file {self.fname}")
--
2.52.0
On Mon, Jan 12, 2026 at 12:23:23PM +0100, Mauro Carvalho Chehab wrote:
> Changeset 469c1c9eb6c9 ("kernel-doc: Issue warnings that were silently discarded")
> didn't properly addressed the missing messages behavior, as
> it was calling directly python logger low-level function,
> instead of using the expected method to emit warnings.
>
> Basically, there are two methods to log messages:
>
> - self.config.log.warning() - This is the raw level to emit a
> warning. It just writes the a message at stderr, via python
> logging, as it is initialized as:
>
> self.config.log = logging.getLogger("kernel-doc")
>
> - self.config.warning() - This is where we actually consider a
> message as a warning, properly incrementing error count.
>
> Due to that, several parsing error messages are internally considered
> as success, causing -Werror to not work on such messages.
>
> While here, ensure that the last ignored entry will also be handled
> by adding an extra check at the end of the parse handler.
Thanks for addressing these issues, Mauro!
I am not promising I will test this soon, but from code perspective it looks
good to me,
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
© 2016 - 2026 Red Hat, Inc.