Hi,
There is a bug in lib/power/power_common.c:
+write_core_sysfs_s(FILE *f, const char *str)
+{
+ int ret;
+
+ ret = fseek(f, 0, SEEK_SET);
+ if (ret != 0)
+ return -1;
+
+ ret = fputs(str, f);
+ if (ret != 0)
+ return -1;
Here, I mentioned in the V4 patch: ret >=0 if success, EOF means failure. It
seems you forgot to fix this.
+
+ /* flush the output */
+ ret = fflush(f);
+ if (ret != 0)
+ return -1;
+
+ return 0;
+}
Best regards,
Richael
> -----Original Message-----
> From: David Hunt <[email protected]>
> Sent: Tuesday, June 22, 2021 9:28 PM
> To: [email protected]
> Cc: [email protected]; [email protected]; Richael
> Zhuang <[email protected]>; Reshma Pattan
> <[email protected]>; nd <[email protected]>
> Subject: Re: [PATCH v5 2/2] power: refactor pstate and acpi code
>
> Adding people to the CC list that were on v4 of this patch set, and Richael
> who raised some issues in v4.
>
> On 22/6/2021 1:58 PM, David Hunt wrote:
> > From: Anatoly Burakov <[email protected]>
> >
> > Currently, ACPI and PSTATE modes have lots of code duplication,
> > confusing logic, and a bunch of other issues that can, and have, led
> > to various bugs and resource leaks.
> >
> > This commit factors out the common parts of sysfs reading/writing for
> > ACPI and PSTATE drivers.
> >
> > Signed-off-by: Anatoly Burakov <[email protected]>
> > Signed-off-by: David Hunt <[email protected]>
> >
> > ---
> > changes in v2 (should read v5)
> > * fixed bugs raised by Richael Zhuang in review - open file rw+, etc.
> > * removed FOPS* and FOPEN* macros, which contained control statements.
> > * fixed some checkpatch warnings.
>
>
> So in the process of posting v5, I picked the email id from v4 in patchwork,
> used that in my --in-reply-to, and somehow it screwed up the threading as it
> looks like I'm responding to v3. So I'm sending this email to make sure all
> the
> people CC'd in v4 are included in this (v5).
>
> Anatoly is busy at the moment, so I'm addressing the issues raised in v4, and
> additionally adressing the checkpatch issues where it does not like the
> macros with control statements, so removing those, as I don't like them
> either.
>
> Regards,
> Dave.
>
>
>