Skip to content

Commit e9d7ff9

Browse files
committed
suit: Fix IPUC search order
Reverse order of IPUC search, so any newly created device is the first one to be returned by the find API. Ref: NCSDK-NONE Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 962f319 commit e9d7ff9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/flash/flash_ipuc/flash_ipuc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,11 @@ struct device *flash_ipuc_find(uintptr_t address, size_t size, uintptr_t *ipuc_a
673673
}
674674

675675
for (size_t i = 0; i < ARRAY_SIZE(ipuc_devs); i++) {
676-
dev = (struct device *)ipuc_devs[i];
676+
/* Due to the existence of permanent IPUCs (i.e. in the DFU cache RW module)
677+
* IPUC list must be searched in the FILO order, so any temporary, newly
678+
* created IPUC driver is returned by an immediate call to the find API.
679+
*/
680+
dev = (struct device *)ipuc_devs[ARRAY_SIZE(ipuc_devs) - 1 - i];
677681
ctx = (struct ipuc_context *)dev->data;
678682
if (ctx->component_id.value == NULL) {
679683
continue;

0 commit comments

Comments
 (0)