[U-Boot] [PATCH] M28: Added pin name support in GPIO driver

Mike Frysinger vapier at gentoo.org
Wed Nov 23 23:11:01 CET 2011


On Wednesday 23 November 2011 04:51:45 Robert Deliën wrote:
> +       if (name[0] >= '0' && name[0] <= '9') {
> +               pin_nr = simple_strtoul(name, (char **)&name, 10);
> +               if (name[0])
> +                       return -EINVAL;
> 
> Why do we need this check ? We have already copied / converted the
> number in pin_nr, we do not need to check in the string again. And you
> do not need to update name, because you are returning in any case.
> 
> This check checks if name pointer - after it's updated by simple_strtoul -
> points to the terminating NULL character. If if does, name contained a
> valid number. If it doesn't, it's pointing to trailing garbage and hence
> name didn't contain a valid number. In other words; This checks prevents a
> string like 3kjh;khji being interpreted as 3.

your client apparently lacks proper quoting.  please do something about this.  
it's fairly difficult to figure out what you're saying and what you're quoting.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111123/d06133c8/attachment.pgp>


More information about the U-Boot mailing list