[PATCH] olpc_dcon: revert strtoul change

Chris Ball cjb at laptop.org
Sun Feb 6 23:05:57 UTC 2011


Hi,

On Sun, Feb 06, 2011 at 02:38:16PM -0800, Andres Salomon wrote:
> The s/simple_strtoul/strict_strtoul/ from commit e107e6eb added a build
> warning, as well as an oops.  This reverts that change.
> 
> Signed-off-by: Andres Salomon <dilinger at queued.net>
> ---
>  drivers/staging/olpc_dcon/olpc_dcon.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/olpc_dcon/olpc_dcon.c b/drivers/staging/olpc_dcon/olpc_dcon.c
> index b19cd34..d6ad5d7 100644
> --- a/drivers/staging/olpc_dcon/olpc_dcon.c
> +++ b/drivers/staging/olpc_dcon/olpc_dcon.c
> @@ -525,7 +525,7 @@ static int _strtoul(const char *buf, int len, unsigned int *val)
>  {
>  
>  	char *endp;
> -	unsigned int output = strict_strtoul(buf, &endp, 0);
> +	unsigned int output = simple_strtoul(buf, &endp, 0);
>  	int size = endp - buf;
>  
>  	if (*endp && isspace(*endp))

Yes, different prototypes:

  unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base)
vs.
  int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)

So, you'd need something like:

unsigned int output;
int ret = strict_strtoul(buf, 0, &output);
if (ret < 0)
	return ret;

-- 
Chris Ball   <cjb at laptop.org>   <http://printf.net/>
One Laptop Per Child



More information about the devel mailing list