mtd: fix registration of multiple ONCHIP devices

This commit is contained in:
alexcekay
2026-04-15 14:03:56 +02:00
committed by Alexander Lerach
parent 3965d84e64
commit 977cb5fe25
+7 -3
View File
@@ -300,6 +300,7 @@ int px4_mtd_config(const px4_mtd_manifest_t *mft_mtd)
for (uint8_t i = num_instances, num_entry = 0u; i < total_new_instances; ++i, ++num_entry) {
rv = -ENOMEM;
instances[i] = new mtd_instance_s;
if (instances[i] == nullptr) {
@@ -315,7 +316,6 @@ memoryout:
instances[i]->mtd_dev = nullptr;
instances[i]->n_partitions_current = 0;
rv = -ENOMEM;
instances[i]->part_dev = new FAR struct mtd_dev_s *[nparts];
if (instances[i]->part_dev == nullptr) {
@@ -358,8 +358,12 @@ memoryout:
#endif
} else if (mtd_list->entries[num_entry]->device->bus_type == px4_mft_device_t::ONCHIP) {
instances[i]->n_partitions_current++;
return 0;
/* ONCHIP type is registered externally.
* Populate the query table for all partitions and skip the MTD attach / geometry
* steps. */
instances[i]->n_partitions_current = nparts;
rv = 0;
continue;
}
if (rv != 0) {