aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-03-25 22:45:43 -0400
committerTom Rini <trini@konsulko.com>2021-03-25 22:45:43 -0400
commit4be994b0e1f006c271e0791a60b6363137542090 (patch)
tree4a880a9274c31963b1a330520c5dd99916164db7 /drivers
parent874dcedee92a828b03c8d3146dccfaa8b709618b (diff)
parentac30aad21076e9eeb460af2865b863f3ae3d2eaa (diff)
downloadu-boot-4be994b0e1f006c271e0791a60b6363137542090.zip
u-boot-4be994b0e1f006c271e0791a60b6363137542090.tar.gz
u-boot-4be994b0e1f006c271e0791a60b6363137542090.tar.bz2
Merge tag 'efi-next' of https://source.denx.de/u-boot/custodians/u-boot-efi into nextWIP/25Mar2021-next
Pull request for efi-next New: provide EFI ESRT table initrd via Load_File2_Protocol uses boot options create an S-CRTM event for measured boot Bug fixes: avoid double free of SPI device in dfu_free_entity() avoid memory leak in TCG2 protocol
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dfu/dfu_sf.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
index 76b629a..8f8c425 100644
--- a/drivers/dfu/dfu_sf.c
+++ b/drivers/dfu/dfu_sf.c
@@ -87,7 +87,23 @@ static unsigned int dfu_polltimeout_sf(struct dfu_entity *dfu)
static void dfu_free_entity_sf(struct dfu_entity *dfu)
{
- spi_flash_free(dfu->data.sf.dev);
+ /*
+ * In the DM case it is not necessary to free the SPI device.
+ * For the non-DM case we must ensure that the the SPI device is only
+ * freed once.
+ */
+ if (!CONFIG_IS_ENABLED(DM_SPI_FLASH)) {
+ struct spi_flash *dev = dfu->data.sf.dev;
+
+ if (!dev)
+ return;
+ dfu->data.sf.dev = NULL;
+ list_for_each_entry(dfu, &dfu_list, list) {
+ if (dfu->data.sf.dev == dev)
+ dfu->data.sf.dev = NULL;
+ }
+ spi_flash_free(dev);
+ }
}
static struct spi_flash *parse_dev(char *devstr)