[PATCH] power: fix pstate number parsing

Thomas Monjalon thomas at monjalon.net
Wed Oct 26 23:33:58 CEST 2022


12/10/2022 14:25, Pattan, Reshma:
> 
> > -----Original Message-----
> > From: Markus Theil <markus.theil at tu-ilmenau.de>
> 
> 
> > +#include <ctype.h>
> 
> This is not needed right.
> 
> >  #include <stdio.h>
> >  #include <stdlib.h>
> >  #include <fcntl.h>
> > @@ -96,7 +97,7 @@ power_read_turbo_pct(uint64_t *outVal)
> > 
> >  	errno = 0;
> >  	*outVal = (uint64_t) strtol(val, &endptr, 10);
> > -	if (*endptr != 0 || errno != 0) {
> > +	if (errno != 0 || (*endptr != 0 && *endptr != '\n')) {
> 
> I encountered today that power library initialization failed and the reason is this \n check. 
> This fix fixes the issue.
> 
> So if you are sending the next version be removing the above mentioned header file, please keep my Review and Ack tags in next version.

Review is enough, it is stronger than ack.
Review means you carefully reviewed the change.




More information about the dev mailing list