Skip to content

Commit

Permalink
[uCode] Modernize and fix error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
liske committed May 16, 2022
1 parent 149e546 commit f8c2609
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions perl/lib/NeedRestart/uCode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,16 @@ sub nr_ucode_check {

# call ucode modules
foreach my $pkg (@PKGS) {
my ( $processor, @nvars) = ('?');
eval "(\$processor, \@nvars) = ${pkg}::nr_ucode_check_real(\$debug, \$ui, \$processors{\$pid});";
print STDERR $@
if ( $@ && $debug );
my @nvars;
eval "\@nvars = ${pkg}::nr_ucode_check_real(\$debug, \$ui, \$processors{\$pid});";
if ( $@ && $debug ) {
print STDERR $@;
$ui->progress_step;
next;
}
$ui->progress_step;

my $nstate = compare_ucode_versions( $debug, $processor, @nvars );
my $nstate = compare_ucode_versions( $debug, $processors{processor}, @nvars );
if ( $nstate > $state ) {
( $state, @vars ) = ( $nstate, @nvars );
}
Expand Down
2 changes: 1 addition & 1 deletion perl/lib/NeedRestart/uCode/AMD.pm
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ sub nr_ucode_check_real {
}
}

return ( $info->{processor}, %vars );
return %vars;
}

1;
4 changes: 2 additions & 2 deletions perl/lib/NeedRestart/uCode/Intel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ sub nr_ucode_check_real {
"$LOGPREF #$info->{processor} current microcode revision not found in /proc/cpuinfo: $!\n"
if ($debug);

return ( NRM_UNKNOWN, %vars );
return %vars;
}

# find and cache microcode updates
Expand All @@ -83,7 +83,7 @@ sub nr_ucode_check_real {
}
$vars{AVAIL} = $_avail if ( defined($_avail) );

return ( $info->{processor}, %vars );
return %vars;
}

1;

0 comments on commit f8c2609

Please sign in to comment.