diff mbox series

[07/18] drivers: fwu: Allocate memory for metadata copies

Message ID 20240122115439.653871-8-sughosh.ganu@linaro.org
State Superseded
Headers show
Series FWU: Migrate FWU metadata to version 2 | expand

Commit Message

Sughosh Ganu Jan. 22, 2024, 11:54 a.m. UTC
With migration of the FWU metadata access code to version 2, the size
of the metadata is obtained at runtime. Allocate memory for both the
metadata copies from the driver's probe function.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
 drivers/fwu-mdata/gpt_blk.c | 4 ++++
 drivers/fwu-mdata/raw_mtd.c | 4 ++++
 2 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/drivers/fwu-mdata/gpt_blk.c b/drivers/fwu-mdata/gpt_blk.c
index 97eac3611f..c2cb7ef7c3 100644
--- a/drivers/fwu-mdata/gpt_blk.c
+++ b/drivers/fwu-mdata/gpt_blk.c
@@ -159,6 +159,10 @@  static int fwu_mdata_gpt_blk_probe(struct udevice *dev)
 
 	priv->blk_dev = mdata_dev;
 
+	ret = fwu_mdata_copies_allocate();
+	if (ret)
+		return ret;
+
 	return 0;
 }
 
diff --git a/drivers/fwu-mdata/raw_mtd.c b/drivers/fwu-mdata/raw_mtd.c
index da36094644..d91518bf0a 100644
--- a/drivers/fwu-mdata/raw_mtd.c
+++ b/drivers/fwu-mdata/raw_mtd.c
@@ -260,6 +260,10 @@  static int fwu_mdata_mtd_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	ret = fwu_mdata_copies_allocate();
+	if (ret)
+		return ret;
+
 	/* Read the metadata to get number of banks and images */
 	ret = fwu_get_banks_images(&nbanks, &nimages);
 	if (ret)