diff --git a/tests/drivers/flash_simulator/src/main.c b/tests/drivers/flash_simulator/src/main.c index d24d605e950..a5825019136 100644 --- a/tests/drivers/flash_simulator/src/main.c +++ b/tests/drivers/flash_simulator/src/main.c @@ -32,7 +32,7 @@ (((((((0xff & pat) << 8) | (0xff & pat)) << 8) | \ (0xff & pat)) << 8) | (0xff & pat)) -static const struct device *flash_dev; +static const struct device *flash_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_flash_controller)); static uint8_t test_read_buf[TEST_SIM_FLASH_SIZE]; static uint32_t p32_inc; @@ -76,10 +76,8 @@ static void test_init(void) { int rc; - flash_dev = device_get_binding(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL); - - zassert_true(flash_dev != NULL, - "Simulated flash driver was not found!"); + zassert_true(device_is_ready(flash_dev), + "Simulated flash device not ready"); rc = flash_erase(flash_dev, FLASH_SIMULATOR_BASE_OFFSET, FLASH_SIMULATOR_FLASH_SIZE);