driver: watchdog: Error handling issues in wdt_wwdg_stm32.c #20503
This patch tests the return code when calling clock_control_get_rate [Coverity CID :205655] Fixes #20503 Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
parent
ea7a1859af
commit
fc06346a77
1 changed files with 8 additions and 2 deletions
|
@ -13,6 +13,9 @@
|
|||
|
||||
#include "wdt_wwdg_stm32.h"
|
||||
|
||||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(wdt_wwdg_stm32);
|
||||
|
||||
#define WWDG_INTERNAL_DIVIDER 4096U
|
||||
#define WWDG_RESET_LIMIT WWDG_COUNTER_MIN
|
||||
#define WWDG_COUNTER_MIN 0x40
|
||||
|
@ -66,8 +69,11 @@ static u32_t wwdg_stm32_get_pclk(struct device *dev)
|
|||
|
||||
__ASSERT_NO_MSG(clk);
|
||||
|
||||
clock_control_get_rate(clk, (clock_control_subsys_t *) &cfg->pclken,
|
||||
&pclk_rate);
|
||||
if (clock_control_get_rate(clk, (clock_control_subsys_t *) &cfg->pclken,
|
||||
&pclk_rate) < 0) {
|
||||
LOG_ERR("Failed call clock_control_get_rate");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return pclk_rate;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue