fix flash/nand name parsing

Start driver.num check from end, and make sure the numeric part is
actually a number.  Fix problems trying to parse bank names.
This commit is contained in:
Zachary T Welch 2009-11-19 18:11:30 -08:00
parent a1777fc649
commit 153848e6cc
1 changed files with 3 additions and 1 deletions

View File

@ -25,9 +25,11 @@
unsigned get_flash_name_index(const char *name)
{
const char *index = strchr(name, '.');
const char *index = strrchr(name, '.');
if (NULL == index)
return 0;
if (index[1] < '0' || index[1] > '9')
return ~0U;
unsigned requested;
int retval = parse_uint(index + 1, &requested);
// detect parsing error by forcing past end of bank list