The "mtdparts add" command wrote through a NULL pointer - on many
systems this went unnoticed (PowerPC has writable RAM there, some ARM
systems have ROM where a write has no effect), but on arm1136
(i.MX31) it crashed the system.
Add appropriate checks.
Signed-off-by: Wolfgang Denk <wd@denx.de>
+ DEBUGF("===device_parse===\n");
+
+ assert(retdev);
- DEBUGF("===device_parse===\n");
+ if (ret)
+ *ret = NULL;
if (!(p = strchr(mtd_id, ':'))) {
printf("no <mtd-id> identifier\n");
return 1;
if (!(p = strchr(mtd_id, ':'))) {
printf("no <mtd-id> identifier\n");
return 1;
/* check for next device presence */
if (p) {
if (*p == ';') {
/* check for next device presence */
if (p) {
if (*p == ';') {
} else {
printf("unexpected character '%c' at the end of device\n", *p);
} else {
printf("unexpected character '%c' at the end of device\n", *p);
+ if (ret)
+ *ret = NULL;