aboutsummaryrefslogtreecommitdiffstats
path: root/mediatek_i2c_spi.c
diff options
context:
space:
mode:
authorAlexander Goncharov <chat@joursoir.net>2022-07-11 01:05:11 +0300
committerAnastasia Klimchuk <aklm@chromium.org>2022-07-15 00:55:57 +0000
commit494bedae23c547e0a3e8f86a5a69cf4b05bd1586 (patch)
treef258ec14dbf385e2bb8dd72c398e777bcabce6b2 /mediatek_i2c_spi.c
parent964af12beece465c8e32e7e548f940ee957c50b7 (diff)
downloadflashrom-494bedae23c547e0a3e8f86a5a69cf4b05bd1586.tar.gz
flashrom-494bedae23c547e0a3e8f86a5a69cf4b05bd1586.tar.bz2
flashrom-494bedae23c547e0a3e8f86a5a69cf4b05bd1586.zip
mediatek_i2c_spi: Use new API to register shutdown function
This allows programmer to register shutdown function in spi_master struct, which means there is no need to call register_shutdown in init function, since this call is now a part of register_spi_master. As a consequence of using new API, this patch also fixes resource leakage in case register_shutdown() would fail. TEST=builds Change-Id: Iab03b8f51d7ec4e20cdae4406896d57903404dd0 Signed-off-by: Alexander Goncharov <chat@joursoir.net> Ticket: https://ticket.coreboot.org/issues/391 Reviewed-on: https://review.coreboot.org/c/flashrom/+/65746 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'mediatek_i2c_spi.c')
-rw-r--r--mediatek_i2c_spi.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mediatek_i2c_spi.c b/mediatek_i2c_spi.c
index e8c77ffb..5757f31e 100644
--- a/mediatek_i2c_spi.c
+++ b/mediatek_i2c_spi.c
@@ -460,6 +460,7 @@ static const struct spi_master spi_master_i2c_mediatek = {
.read = default_spi_read,
.write_256 = default_spi_write_256,
.write_aai = default_spi_write_aai,
+ .shutdown = mediatek_shutdown,
.probe_opcode = default_spi_probe_opcode,
};
@@ -496,10 +497,7 @@ static int mediatek_init(void)
return ret;
}
- ret |= register_shutdown(mediatek_shutdown, port);
- ret |= register_spi_master(&spi_master_i2c_mediatek, port);
-
- return ret;
+ return register_spi_master(&spi_master_i2c_mediatek, port);
}
const struct programmer_entry programmer_mediatek_i2c_spi = {