diff mbox series

[v2,06/16] reset: Avoid a warning in devm_regmap_init()

Message ID 20210514014011.2832707-4-sjg@chromium.org
State Accepted
Commit 37e79ee0e8f93674a6247cf5c973920f18fd3578
Delegated to: Tom Rini
Headers show
Series [v2,01/16] sandbox: net: Ensure host name is always a valid string | expand

Commit Message

Simon Glass May 14, 2021, 1:39 a.m. UTC
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.

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

Changes in v2:
- Add a standard comment instead of a Coverity annotation

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

Comments

Tom Rini July 16, 2021, 3:51 p.m. UTC | #1
On Thu, May 13, 2021 at 07:39:22PM -0600, Simon Glass wrote:

> 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.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reported-by: Coverity (CID: 312951)

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index b51ce108c14..982c2ee9fab 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;
 
+	/* this looks like a leak, but devres takes care of it */
 	mapp = devres_alloc(devm_regmap_release, sizeof(struct regmap *),
 			    __GFP_ZERO);
 	if (unlikely(!mapp))