Remove redundant re-checking of return from read_msr()

The re-checking of the read_msr return code is redundant
and should be removed.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Improve accuracy of unit_value calculation

Coverity Scan reports:

integer_division: Dividing integer expressions 100 and
this->max_state, and then converting the integer quotient
to type float. Any remainder, or fractional part of the
quotient, is ignored.

So divide 100.0 by max_state rather than integer 100 for
improved accuracy.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Null terminate buffer on error return path

Coverity Scan is being rather too paranoid about the error return
path not null terminating a string. This is a false positive in the
code, but it does make some sense to ensure the string is null
terminated in case future callers to csys_fs::read_symbolic_link_value
are sloppy in their error return checking.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Fix resource leak on file descriptor, close fd on error return paths

read_art and read_trt are not closing fd on several error return paths
causing a resource like on file descriptors, so fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>