/* Function for freeing a device instance allocated for bonded device.  */
static __INLINE ret_code_t device_instance_free(uint32_t device_index)
/* Function for freeing a device instance allocated for bonded device.  */
static __INLINE ret_code_t device_instance_free(uint32_t device_index)
{
    ret_code_t      err_code;
    pstorage_handle_t block_handle;
    err_code = pstorage_block_identifier_get(&m_storage_handle, device_index, &block_handle);
    if (err_code == NRF_SUCCESS)
    {
        DM_TRC("[DM]:[DI 0x%02X]: Freeing Instance.\r\n", device_index);
        err_code = pstorage_clear(&block_handle, ALL_CONTEXT_SIZE);
        if (err_code == NRF_SUCCESS)
        {
            peer_instance_init(device_index);
        }
    }
    return err_code;
}