From c7dd17062c1c0936d649f285c0013bb4a397e41c Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Sun, 2 May 2021 19:00:37 +0200 Subject: lspcon_i2c_spi: Release I2C fd on failed init Change-Id: Idec3cd349ab8d6e2ebb0fafae70c5d69bb2c8880 Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/flashrom/+/52829 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan Reviewed-by: Anastasia Klimchuk Reviewed-by: Peter Marheine --- lspcon_i2c_spi.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lspcon_i2c_spi.c') diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c index b79e7f7b4..e2c4a3c35 100644 --- a/lspcon_i2c_spi.c +++ b/lspcon_i2c_spi.c @@ -502,12 +502,14 @@ int lspcon_i2c_spi_init(void) int ret = lspcon_i2c_spi_reset_mpu_stop(fd); if (ret) { msg_perr("%s: call to reset_mpu_stop failed.\n", __func__); + i2c_close(fd); return ret; } struct lspcon_i2c_spi_data *data = calloc(1, sizeof(struct lspcon_i2c_spi_data)); if (!data) { msg_perr("Unable to allocate space for extra SPI master data.\n"); + i2c_close(fd); return SPI_GENERIC_ERROR; } -- cgit v1.2.3