mgmt/mcumgr/lib: Fix image list command crashing when no device
It is possible, in case of two application images, to have no access to one of devices of the secondary image. When asserts are enabled, such situation causes crash even though the image list command can handle it with no problem. The commit removes the assert and adds additional swap type: IMG_MGMT_SWAP_TYPE_UNKNOWN to indicate situations where it was not possible to obtain swap type from boot_util. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
parent
54b2fc0774
commit
19259ab7db
|
@ -41,6 +41,7 @@ extern "C" {
|
|||
#define IMG_MGMT_SWAP_TYPE_TEST 1
|
||||
#define IMG_MGMT_SWAP_TYPE_PERM 2
|
||||
#define IMG_MGMT_SWAP_TYPE_REVERT 3
|
||||
#define IMG_MGMT_SWAP_TYPE_UNKNOWN 255
|
||||
|
||||
/**
|
||||
* Command IDs for image management group.
|
||||
|
|
|
@ -511,8 +511,7 @@ img_mgmt_impl_swap_type(int slot)
|
|||
case BOOT_SWAP_TYPE_REVERT:
|
||||
return IMG_MGMT_SWAP_TYPE_REVERT;
|
||||
default:
|
||||
assert(0);
|
||||
return IMG_MGMT_SWAP_TYPE_NONE;
|
||||
return IMG_MGMT_SWAP_TYPE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue