Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons. Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/54042 )
Change subject: stlinkv3_spi.c: Refactor singleton states into reentrant pattern ......................................................................
Patch Set 1:
(1 comment)
File stlinkv3_spi.c:
https://review.coreboot.org/c/flashrom/+/54042/comment/2ce2fb60_57b29ba1 PS1, Line 533: stlinkv3_spi_open(sck_freq_kHz, stlinkv3_handle
Uh, good point.
Before this commit, the handle was closed unless register_shutdown() failed.
I am confused, because register_shutdown is called after this line, and it was after this line before. So if stlinkv3_spi_open fails, at that point shutdown hasn't been registered yet and so handle wasn't closed. Maybe I am missing something obvious or misunderstand something?
I don't want to do a regression, definitely don't want. I really want to make things better, not worse... sorry if my words sound as "blaming existing code".
So, I don't want to leave this in a state which looks worse than it was. Maybe I can just fix all init error paths here? what do you think