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:
parent
a1777fc649
commit
153848e6cc
|
@ -25,9 +25,11 @@
|
||||||
|
|
||||||
unsigned get_flash_name_index(const char *name)
|
unsigned get_flash_name_index(const char *name)
|
||||||
{
|
{
|
||||||
const char *index = strchr(name, '.');
|
const char *index = strrchr(name, '.');
|
||||||
if (NULL == index)
|
if (NULL == index)
|
||||||
return 0;
|
return 0;
|
||||||
|
if (index[1] < '0' || index[1] > '9')
|
||||||
|
return ~0U;
|
||||||
unsigned requested;
|
unsigned requested;
|
||||||
int retval = parse_uint(index + 1, &requested);
|
int retval = parse_uint(index + 1, &requested);
|
||||||
// detect parsing error by forcing past end of bank list
|
// detect parsing error by forcing past end of bank list
|
||||||
|
|
Loading…
Reference in New Issue