[PATCH 07/17] reset: Avoid a warning in devm_regmap_init()

Simon Glass sjg at chromium.org
Sun May 9 00:00:11 CEST 2021


The devres_alloc() function is intended to avoid the need for freeing
memory, although in practice it may not be enabled, thus leading to a true
leak.

Nevertheless this is intended. Add a comment to molify Coverity.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reported-by: Coverity (CID: 312951)
---

 drivers/core/regmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index b51ce108c14..15ed189352c 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -293,6 +293,7 @@ struct regmap *devm_regmap_init(struct udevice *dev,
 	int rc;
 	struct regmap **mapp, *map;
 
+	/* coverity[RESOURCE_LEAK] */
 	mapp = devres_alloc(devm_regmap_release, sizeof(struct regmap *),
 			    __GFP_ZERO);
 	if (unlikely(!mapp))
-- 
2.31.1.607.g51e8a6a459-goog



More information about the U-Boot mailing list