Infinite loop on edge cases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, I have been testing the latest RTC drivers on an OpenWrt build
on a MTK7688 SOC and I got an infinite loop on boot that would block
the entire system.
Basically, if I don't have a RTC connected, any read would return
0xFF. That may be also be a problem of the I2C driver, that instead of
generating an error just returns that value. But this may happen in
other cases, like if we add an EEPROM or another IC with the same
address as the RTC, or the RTC IC fails in some unpredictable way.
The current implementation of that piece of code has some bad
practices that lead to infinite loops due to this error.
Since on these RTCs the byte at address 0x00 will never be 0xFF (check
the datasheet), I added a sanity check for this special case.
A better way to do this would be to add a retry counter when setting
the CH bit, but that's  an even more edge case that will probably
never happen.
The same infinite loop will happen on other RTC ICs that do a similar
check in other parts of code, but I don't have them so I can't edit
the code and test it.
The code has been tested and works; please consider merging it.
Thanks,
Best regards
Cristiano Griletti - Mastro Gippo

Attachment: 0001-Fixed-infinite-loop-if-RTC-is-broken-disconnected.patch
Description: Binary data


[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux