Skip to content

[Backport v4.0-branch] drivers: i2c: stm32: add timeout to avoid infinite loop #90660

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

Open
wants to merge 1 commit into
base: v4.0-branch
Choose a base branch
from

Conversation

github-actions[bot]
Copy link

Backport 2066b8c from #88631.

Fix issue where STM32 I2C LL driver could block forever when SDA and SCL
are shorted and interrupts are disabled (CONFIG_I2C_STM32_INTERRUPT=n).

Added timeouts to all blocking wait loops in the STM32 LL I2C driver to
avoid indefinite blocking.

Fixes #88506

Signed-off-by: Jean Nanchen <[email protected]>
(cherry picked from commit 2066b8c)
@github-actions github-actions bot added the Backport Backport PR and backport failure issues label May 27, 2025
@github-actions github-actions bot requested a review from ydamigos as a code owner May 27, 2025 11:02
@github-project-automation github-project-automation bot moved this to To do in Backports May 27, 2025
Copy link

@@ -1181,5 +1201,26 @@ int stm32_i2c_transaction(const struct device *dev,
msg.len = rest;
} while (rest > 0U);

#ifndef CONFIG_I2C_STM32_INTERRUPT
struct i2c_stm32_data *data = dev->data;

Copy link
Collaborator

Choose a reason for hiding this comment

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

missing

Suggested change
const struct i2c_stm32_config *cfg = dev->config;
I2C_TypeDef *i2c = cfg->i2c;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport Backport PR and backport failure issues
Projects
Status: To do
Development

Successfully merging this pull request may close these issues.

3 participants