Skip to content

Commit 08cc15a

Browse files
gautierg-stkartben
authored andcommitted
drivers: flash: stm32 xspi: replace prescaler assert by returning error
Replace the assert on the value of the prescaler by a standard check and an error value return (similar to the STM32 XSPI PSRAM driver). Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
1 parent d236012 commit 08cc15a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/flash/flash_stm32_xspi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,8 +2131,11 @@ static int flash_stm32_xspi_init(const struct device *dev)
21312131
break;
21322132
}
21332133
}
2134-
__ASSERT_NO_MSG(prescaler >= STM32_XSPI_CLOCK_PRESCALER_MIN &&
2135-
prescaler <= STM32_XSPI_CLOCK_PRESCALER_MAX);
2134+
2135+
if (prescaler > STM32_XSPI_CLOCK_PRESCALER_MAX) {
2136+
LOG_ERR("XSPI could not find valid prescaler value");
2137+
return -EINVAL;
2138+
}
21362139

21372140
/* Initialize XSPI HAL structure completely */
21382141
dev_data->hxspi.Init.ClockPrescaler = prescaler;

0 commit comments

Comments
 (0)