Hello Wojciech,
On 23.05.25 12:57, Wojciech Szamocki wrote:
Change the return value for timeout errors in i2c-designware from 1 to
-ETIMEDOUT. Returning errors as negative values is standard practice in the
u-boot, which enhances error handling consistency across the codebase.
The current behavior can lead to silent errors when functions check for
negative return values to identify errors. For example, in
`dm_i2c_reg_read` from i2c-uclass.c, a timeout results in an uninitialized
value being returned, potentially causing unexpected behavior.
Cc: Heiko Schocher <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Wojciech Szamocki <[email protected]>
Signed-off-by: Wojciech Szamocki <[email protected]>
---
drivers/i2c/designware_i2c.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
Thanks!
Reviewed-by: Heiko Schocher <[email protected]>
bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: [email protected]