[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ca53e90a-f4eb-5007-a137-62729e3d74f0@linuxfoundation.org>
Date: Thu, 29 Oct 2020 15:38:43 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: Borislav Petkov <bp@...en8.de>
Cc: X86 ML <x86@...nel.org>, Thomas Renninger <trenn@...e.com>,
Shuah Khan <shuah@...nel.org>, Len Brown <lenb@...nel.org>,
linux-pm@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH 1/4] tools/power/cpupower: Read energy_perf_bias from
sysfs
On 10/16/20 2:37 AM, Borislav Petkov wrote:
> On Thu, Oct 15, 2020 at 11:49:32AM -0600, Shuah Khan wrote:
>> Is there a reason to move "int fd"?
>
Sorry for a late response.
Okay. Looked odd since it didn't need changing.
> 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?
Right. It will be great if you can add filename to the message.
>
>> 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?
>
All of the other ones should be changed as such. Why add more?
thanks,
-- Shuah
Powered by blists - more mailing lists