diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a325a0c890dc..e5bf649e516a 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -337,6 +337,7 @@ sub get_kernel_version() {
}
return $version;
}
+my $kernelversion = get_kernel_version();
# generate a sequence of code that will splice in highlighting information
# using the s// operator.
@@ -610,7 +611,7 @@ sub output_function_xml(%) {
print "\n";
print " ".$args{'function'}."\n";
print " 9\n";
- print " " . get_kernel_version() . "\n";
+ print " " . $kernelversion . "\n";
print "\n";
print "\n";
print " ".$args{'function'}."\n";
@@ -687,7 +688,7 @@ sub output_struct_xml(%) {
print "\n";
print " ".$args{'type'}." ".$args{'struct'}."\n";
print " 9\n";
- print " " . get_kernel_version() . "\n";
+ print " " . $kernelversion . "\n";
print "\n";
print "\n";
print " ".$args{'type'}." ".$args{'struct'}."\n";
@@ -772,7 +773,7 @@ sub output_enum_xml(%) {
print "\n";
print " enum ".$args{'enum'}."\n";
print " 9\n";
- print " " . get_kernel_version() . "\n";
+ print " " . $kernelversion . "\n";
print "\n";
print "\n";
print " enum ".$args{'enum'}."\n";