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

Sughosh Ganu sughosh.ganu at linaro.org
Mon Jan 22 12:54:28 CET 2024


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 at linaro.org>
---
 drivers/fwu-mdata/gpt_blk.c | 4 ++++
 drivers/fwu-mdata/raw_mtd.c | 4 ++++
 2 files changed, 8 insertions(+)

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)
-- 
2.34.1



More information about the U-Boot mailing list