diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 8323ff9dec71..8bcf90407929 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -3216,4 +3216,4 @@ if ($verbose && $warnings) {
   print STDERR "$warnings warnings\n";
 }
 
-exit($errors);
+exit($output_mode eq "none" ? 0 : $errors);