/* Finds image given version number. Returns the slot number image is in, or -1 if not found.  */
int img_mgmt_find_by_ver(struct image_version *find, uint8_t *hash)
/* Finds image given version number. Returns the slot number image is in, or -1 if not found.  */
int img_mgmt_find_by_ver(struct image_version *find, uint8_t *hash)
{
	int i;
	struct image_version ver;
	for (i = 0; i < 2 * CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER; i++) {
		if (img_mgmt_read_info(i, &ver, hash, NULL) != 0) {
			continue;
		}
		if (!memcmp(find, &ver, sizeof(ver))) {
			return i;
		}
	}
	return -1;
}