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:
parent
2bd80c6fb1
commit
8891943117
1 changed files with 5 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue