diff options
author | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-04-14 14:25:00 +0200 |
---|---|---|
committer | Petri Latvala <petri.latvala@intel.com> | 2022-04-14 18:19:39 +0300 |
commit | 697241a99a30774e3a43676f641f4cb601ecda18 (patch) | |
tree | 172076cfe92e649529f0b15972c5f541b37818d3 /scripts | |
parent | e96b67a069da8ab2a2b884a0ca0446d6cf4fe945 (diff) |
code_cov_parse_info: fix --show-lines logic
print_code_coverage function needs to first read the number
of lines and then simplify the $file by removing its prefix.
Without that, it ends trying to access an uninitiated value,
leading to warnings and not doing what's expected.
While here, also check if the ln data is valid, just in case
the .info file might have some FN field(s) missing.
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/code_cov_parse_info | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/code_cov_parse_info b/scripts/code_cov_parse_info index c8284a29..0d9bac38 100755 --- a/scripts/code_cov_parse_info +++ b/scripts/code_cov_parse_info @@ -378,8 +378,10 @@ sub print_code_coverage($$$) } if ($show_lines) { + my $ln = $all_func{$func}{$file}->{ln}; $file =~ s,$prefix,linux/,; - $name = "$func() from $file:" . $all_func{$func}{$file}->{ln}; + $name = "$func() from $file"; + $name .= ":" . $ln if ($ln); } elsif (scalar @keys > 1) { $file =~ s,$prefix,linux/,; $name = "$func() from $file:"; |