RE: [PATCH 5/5] staging:ti dspbridge: replace simple_strtoul by strict_strtoul

From: Ramos Falcon, Ernesto
Date: Tue Aug 03 2010 - 13:34:11 EST


>-----Original Message-----
>From: Andy Shevchenko [mailto:andy.shevchenko@xxxxxxxxx]
>Sent: Wednesday, July 28, 2010 1:44 PM
>To: Ramos Falcon, Ernesto
>Cc: gregkh@xxxxxxx; Ramirez Luna, Omar; ohad@xxxxxxxxxx;
>ameya.palande@xxxxxxxxx; felipe.contreras@xxxxxxxxx; Guzman Lugo, Fernando;
>linux-kernel@xxxxxxxxxxxxxxx; Menon, Nishanth; linux-omap@xxxxxxxxxxxxxxx
>Subject: Re: [PATCH 5/5] staging:ti dspbridge: replace simple_strtoul by
>On Wed, Jul 28, 2010 at 5:40 PM, Ernesto Ramos <ernesto@xxxxxx> wrote:
>> Replace simple_strtoul by strict_strtoul in atoi function.
>In general the question what is the purpose here to do the change?

It is recommended to use strict_strtoul instead of simple_strtoul since ensures the string is really a valid unsigned long. This also removes checkpatch warning message.

>> @@ -1023,7 +1025,9 @@ static s32 atoi(char *psz_buf)
>>                base = 16;
>>        }
>> -       return simple_strtoul(pch, NULL, base);
>> +       ret_val = strict_strtoul(pch, base, &res);
>> +
>> +       return ret_val ? : res;
>May be better to use explicit values in condition?

I think this is ok as it is, I'm not sure but I think it maybe defined in any C ansi book, in this case if ret_val is unequal to 0 ret_val is returned.

>With Best Regards,
>Andy Shevchenko
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at