Merge "Revert "qca: restricts 'runmulticore' command on secondary cores""
diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c
index ebdc25d..380db53 100644
--- a/common/cmd_mtdparts.c
+++ b/common/cmd_mtdparts.c
@@ -1622,10 +1622,6 @@
 		}
 		p++;
 
-		/* check if requested device exists */
-		if (mtd_device_validate(type, num, &size) != 0)
-			return 1;
-
 		/* locate <mtd-id> */
 		mtd_id = p;
 		if ((p = strchr(mtd_id, ',')) != NULL) {
@@ -1639,6 +1635,13 @@
 			break;
 		}
 
+		/* check if requested device exists */
+		if (mtd_device_validate(type, num, &size) != 0) {
+			/* Skip adding invalid mtd to list entry */
+			ret = 0;
+			continue;
+		}
+
 		/* check if this id is already on the list */
 		int double_entry = 0;
 		list_for_each(entry, &mtdids) {