drivers/clock_control: stm32: clock_control_on: check cc-sub_system

This commit adds a check for the validity of the "sub_system" param in
clock_control_on.

While for clock_control_off there was a check if the clock_subsytem
parameter is in range of STM32_PERIPH_BUS_MIN and STM32_PERIPH_BUS_MAX
this check was missing for clock_control_on.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
This commit is contained in:
Thomas Stranger 2022-06-17 20:59:38 +02:00 committed by Carles Cufí
commit 8891943117

View file

@ -139,6 +139,11 @@ static inline int stm32_clock_control_on(const struct device *dev,
ARG_UNUSED(dev);
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) {
/* Attemp to change a wrong periph clock bit */
return -ENOTSUP;
}
reg = (uint32_t *)(DT_REG_ADDR(DT_NODELABEL(rcc)) + pclken->bus);
reg_val = *reg;
reg_val |= pclken->enr;