Skip to content

Commit

Permalink
drivers: timer: stm32 lptim driver check clock_control_on return code
Browse files Browse the repository at this point in the history
This PR is Calling "clock_control_on" and checking return value
(as is done elsewhere 10 out of 11 times)
CID 322066:  Error handling issues  (CHECKED_RETURN)

Signed-off-by: Francois Ramu <francois.ramu@st.com>
  • Loading branch information
FRASTM authored and fabiobaltieri committed Jul 19, 2023
1 parent e13c193 commit 6254527
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/timer/stm32_lptim_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ void sys_clock_set_timeout(int32_t ticks, bool idle)
{
/* new LPTIM AutoReload value to set (aligned on Kernel ticks) */
uint32_t next_arr = 0;
int err;

ARG_UNUSED(idle);

Expand All @@ -192,8 +193,11 @@ void sys_clock_set_timeout(int32_t ticks, bool idle)
}

/* if LPTIM clock was previously stopped, it must now be restored */
clock_control_on(clk_ctrl, (clock_control_subsys_t) &lptim_clk[0]);
err = clock_control_on(clk_ctrl, (clock_control_subsys_t) &lptim_clk[0]);

if (err < 0) {
return;
}
/* passing ticks==1 means "announce the next tick",
* ticks value of zero (or even negative) is legal and
* treated identically: it simply indicates the kernel would like the
Expand Down Expand Up @@ -328,7 +332,6 @@ static int sys_clock_driver_init(void)
uint32_t count_per_tick;
int err;


if (!device_is_ready(clk_ctrl)) {
return -ENODEV;
}
Expand Down

0 comments on commit 6254527

Please sign in to comment.