[igt-dev] [PATCH 1/6] scripts/code_cov_parse_info: avoid warning messages on parsing

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Thu Sep 22 08:46:13 UTC 2022


From: Mauro Carvalho Chehab <mchehab at kernel.org>

Some fields (FNH, BRH, LH) produce warning messages when they're found
at the info file.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
---

To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 0/6] at: https://lore.kernel.org/all/cover.1663836123.git.mchehab@kernel.org/

 scripts/code_cov_parse_info | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/code_cov_parse_info b/scripts/code_cov_parse_info
index 09f9aba5760b..78b7e2dada5e 100755
--- a/scripts/code_cov_parse_info
+++ b/scripts/code_cov_parse_info
@@ -195,7 +195,7 @@ sub parse_info_data($)
 		# FNH:<number of function hit>
 		if (m/^FNH:(-?\d+)/) {
 			my $hits = $1;
-			if ($record{$source}{$func}{fnh} < $hits) {
+			if (!defined($record{$source}{$func}{fnh}) || $record{$source}{$func}{fnh} < $hits) {
 				$record{$source}{$func}{fnh} = $hits;
 			}
 			next;
@@ -234,7 +234,7 @@ sub parse_info_data($)
 		# BRH:<number of branches hit>
 		if (m/^BRH:(-?\d+)/) {
 			my $hits = $1;
-			if ($record{$source}{$func}{brh} < $hits) {
+			if (!defined($record{$source}{$func}{brh}) || $record{$source}{$func}{brh} < $hits) {
 				$record{$source}{$func}{brh} = $hits;
 			}
 			next;
@@ -268,7 +268,7 @@ sub parse_info_data($)
 		# LH:<number of lines with a non-zero execution count>
 		if (m/^LH:(-?\d+)/) {
 			my $hits = $1;
-			if ($record{$source}{$func}{lh} < $hits) {
+			if (!defined($record{$source}{$func}{lh}) || $record{$source}{$func}{lh} < $hits) {
 				$record{$source}{$func}{lh} = $hits;
 			}
 			next;
-- 
2.37.2



More information about the igt-dev mailing list