Skip to content

Commit

Permalink
pmdadenki: remove unreachable code relating to sign (covscan)
Browse files Browse the repository at this point in the history
Coverity static code checking noticed that there's a check for
negative power_now values in the denki PMDA - this cannot ever
happen, however, because an unsigned integer type is used when
reading and exporting this value.  As a result its safe to not
perform this additional check (current code is unreachable).
  • Loading branch information
natoscott committed Oct 30, 2023
1 parent f886f86 commit 7e82572
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/pmdas/denki/denki.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,6 @@ static int read_batteries(void) {
pmNotifyErr(LOG_DEBUG, "Could not read %s.",filename);
fclose(fff);

// correct power_now, if we got a negative value
if ( power_now[bat]<0 )
power_now[bat]*=-1.0;

// capacity
pmsprintf(filename,sizeof(filename),"%s/capacity",battery_basepath[bat]);
fff=fopen(filename,"r");
Expand Down

0 comments on commit 7e82572

Please sign in to comment.