Message ID | 20210508220021.1778080-8-sjg@chromium.org |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
Series | Fix various coverity warnings | expand |
> Subject: [PATCH 07/17] reset: Avoid a warning in devm_regmap_init() s/reset/regmap/ On 08/05/21 04:00PM, 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 to molify Coverity. > > Signed-off-by: Simon Glass <sjg@chromium.org> > Reported-by: Coverity (CID: 312951) Acked-by: Pratyush Yadav <p.yadav@ti.com> > --- > > 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))
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))
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@chromium.org> Reported-by: Coverity (CID: 312951) --- drivers/core/regmap.c | 1 + 1 file changed, 1 insertion(+)