Daniel Kurtz has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/47655 )
Change subject: it85spi.c: Refactor singleton states into reentrant pattern ......................................................................
Patch Set 8:
(3 comments)
https://review.coreboot.org/c/flashrom/+/47655/8/it85spi.c File it85spi.c:
https://review.coreboot.org/c/flashrom/+/47655/8/it85spi.c@240 PS8, Line 240: (struct it85spi_data *) Is this explicit cast really needed? Typically I would no expect this for cast-from-void *.
https://review.coreboot.org/c/flashrom/+/47655/8/it85spi.c@308 PS8, Line 308: free(data); nit: In general, this would be a bit more robust using gotos:
int ret;
...
if (...) { ret = 1; goto free_data; }
...
if (...) { ret = 1; goto free_data; }
...
return 0;
free_data: free(data); return ret;
https://review.coreboot.org/c/flashrom/+/47655/8/it85spi.c@338 PS8, Line 338: free(data); on second thought ... if you already called register_shutdown() ... will it85xx_shutdown() get called now when if this function exits with "1"? If so, won't this now be a double free()?