Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix divide by zero error

When working with a small number of commits, overall_add/del/mod might
be zero.  If overall is zero, so should the other data, so printing 0%
seems fine.

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information...
commit a74869684b7e88aa7c4655afa28c1c7d9011dce7 1 parent 05aa63d
Andy Gospodarek authored committed
Showing with 3 additions and 3 deletions.
  1. +3 −3 scripts/genstat.pl
View
6 scripts/genstat.pl
@@ -184,9 +184,9 @@ ($$$$$)
sub print_data($$$$)
{
my ($basename, $add, $del, $mod) = @_;
- my $percent_add = $add/$overall_add*100;
- my $percent_del = $del/$overall_del*100;
- my $percent_mod = $mod/$overall_mod*100;
+ my $percent_add = $overall_add ? $add/$overall_add*100 : 0;
+ my $percent_del = $overall_del ? $del/$overall_del*100 : 0;
+ my $percent_mod = $overall_mod ? $mod/$overall_mod*100 : 0;
print "\n$basename:\n";
printf "\tadded = %8d\t%6.2f", $add, $percent_add;
Please sign in to comment.
Something went wrong with that request. Please try again.