reset: Avoid a warning in devm_regmap_init()
authorSimon Glass <sjg@chromium.org>
Fri, 14 May 2021 01:39:22 +0000 (19:39 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 15 Jul 2021 22:42:05 +0000 (18:42 -0400)
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)
drivers/core/regmap.c

index 3206f3d..5f98f85 100644 (file)
@@ -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))