On Thu, Oct 15, 2020 at 11:49:32AM -0600, Shuah Khan wrote:Sorry for a late response.
Is there a reason to move "int fd"?
Habit from tip - we sort function-local variables in a reverse fir tree
order. And since I'm adding cpupower_write_sysfs(), I made them look
consistent.
+ numwritten = write(fd, buf, buflen - 1);
+ if (numwritten < 1) {
+ perror("write failed");
Please add filename to the error message
perror(path);
or do you want me to build a string with an error message and filename?
Please add return check for snprintf, please add a define for
"cpu%u/power/energy_perf_bias" since it is hardcoded in
read/write functions.
None of the other snprintf() calls in cpupower do that. Nothing checks
snprintf() retval and the last part of the sysfs path is a naked string.
Why is this different?