Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/48196 )
Change subject: Simplifying the initialisation flow for it85spi ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/flashrom/+/48196/1/it85spi.c File it85spi.c:
https://review.coreboot.org/c/flashrom/+/48196/1/it85spi.c@303 PS1, Line 303: data = calloc(1, sizeof(struct it85spi_data)); : if (!data) { : msg_perr("Unable to allocate space for extra SPI master data.\n"); : return SPI_GENERIC_ERROR; : } : : spi_master_it85xx.data = data; : : if (register_shutdown(it85xx_shutdown, data)) { : goto it85spi_init_error;
this whole block moves towards the end of the function and therefore there is no need for goto's.
in fact don't even bother checking the return value of register_shutdown() as it's useless to do so as every call is always valid. therefore this constructor shall have no free()'s in its error paths and therefore no need for goto's as it is a single phase construction.