diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-05-02 19:00:37 +0200 |
---|---|---|
committer | Edward O'Callaghan <quasisec@chromium.org> | 2021-05-09 03:33:35 +0000 |
commit | c7dd17062c1c0936d649f285c0013bb4a397e41c (patch) | |
tree | 39d771280bf83fb0f866593f9cef15a35a9aa65e /lspcon_i2c_spi.c | |
parent | 2bbc0704c125761f985f847583947274e05f0d9c (diff) | |
download | flashrom-c7dd17062c1c0936d649f285c0013bb4a397e41c.tar.gz flashrom-c7dd17062c1c0936d649f285c0013bb4a397e41c.tar.bz2 flashrom-c7dd17062c1c0936d649f285c0013bb4a397e41c.zip |
lspcon_i2c_spi: Release I2C fd on failed init
Change-Id: Idec3cd349ab8d6e2ebb0fafae70c5d69bb2c8880
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52829
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Diffstat (limited to 'lspcon_i2c_spi.c')
-rw-r--r-- | lspcon_i2c_spi.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c index b79e7f7b..e2c4a3c3 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; } |