[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201016083754.GB8483@zn.tnic>
Date: Fri, 16 Oct 2020 10:37:54 +0200
From: Borislav Petkov <bp@...en8.de>
To: Shuah Khan <skhan@...uxfoundation.org>
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>
Subject: Re: [PATCH 1/4] tools/power/cpupower: Read energy_perf_bias from
sysfs
On Thu, Oct 15, 2020 at 11:49:32AM -0600, Shuah Khan wrote:
> 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?
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists