Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stm32: coverity fixes (gpio and watchdog) #33124

Merged
merged 2 commits into from
Mar 9, 2021

Conversation

erwango
Copy link
Member

@erwango erwango commented Mar 8, 2021

Fixes: [Coverity CID :219652] Unchecked return value in drivers/gpio/gpio_stm32.c #33035
Fixes: [Coverity CID :219600] Unchecked return value in drivers/watchdog/wdt_wwdg_stm32.c #33067

@erwango erwango requested review from ABOSTM and FRASTM as code owners March 8, 2021 07:44
@github-actions github-actions bot added area: Watchdog Watchdog platform: STM32 ST Micro STM32 labels Mar 8, 2021
@erwango erwango force-pushed the fix_coverity_gpio_return branch from f2e6999 to 74a0e10 Compare March 8, 2021 08:46
@erwango erwango force-pushed the fix_coverity_gpio_return branch from 74a0e10 to 99dc74c Compare March 8, 2021 12:56
@zephyrbot zephyrbot requested review from katsuster and mnkp March 8, 2021 12:56
In function gpio_stm32_enable_int, retiurn value of clock_control_on
was not checked.
This is reported as an issue by coverity (CID 219652).
Fix this.

Fixes zephyrproject-rtos#33035

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
@erwango erwango force-pushed the fix_coverity_gpio_return branch from 99dc74c to 5224332 Compare March 8, 2021 12:57
@erwango erwango requested a review from gmarull March 8, 2021 13:09

wwdg_stm32_irq_config(dev);

return 0;
ret = clock_control_on(clk, (clock_control_subsys_t *) &cfg->pclken);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: you may return directly here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@erwango erwango force-pushed the fix_coverity_gpio_return branch from 5224332 to 72c2fc1 Compare March 8, 2021 13:15
@erwango erwango requested a review from gmarull March 8, 2021 15:19
@@ -250,12 +250,11 @@ static int wwdg_stm32_init(const struct device *dev)
{
const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE);
const struct wwdg_stm32_config *cfg = WWDG_STM32_CFG(dev);

clock_control_on(clk, (clock_control_subsys_t *) &cfg->pclken);
int ret;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed now?

In function wwdg_stm32_init, return value of clock_control_on
was not checked.
This is reported as an issue by coverity (CID 219600).
Fix this.

Fixes zephyrproject-rtos#33067

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
@erwango erwango force-pushed the fix_coverity_gpio_return branch from 72c2fc1 to a6cffea Compare March 8, 2021 15:36
@nashif nashif merged commit 7dc6b03 into zephyrproject-rtos:master Mar 9, 2021
@erwango erwango deleted the fix_coverity_gpio_return branch May 16, 2022 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants