[PATCH master 1/2] nvmem: regmap: fix use of uninitialized space with nvmem_regmap_register

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Jun 18 20:32:11 PDT 2021


Looking through all instances of struct nvmem_config in the tree shows
that only the new nvmem_regmap_register failed to initialize all
members, e.g. config::read_only was uninitialized. Fix this up.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/nvmem/regmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvmem/regmap.c b/drivers/nvmem/regmap.c
index 346d2516f3c3..641e6413ba0b 100644
--- a/drivers/nvmem/regmap.c
+++ b/drivers/nvmem/regmap.c
@@ -60,7 +60,7 @@ static struct nvmem_bus nvmem_regmap_bus = {
 
 struct nvmem_device *nvmem_regmap_register(struct regmap *map, const char *name)
 {
-	struct nvmem_config config;
+	struct nvmem_config config = {};
 
 	/* Can be retrofitted if needed */
 	if (regmap_get_reg_stride(map) != regmap_get_val_bytes(map))
-- 
2.29.2




More information about the barebox mailing list