[PATCH 06/17] reset: Avoid a warning in devm_reset_bulk_get_by_node()

Simon Glass sjg at chromium.org
Sun May 9 00:00:10 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: 312952)
---

 drivers/reset/reset-uclass.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c
index ac89eaf098a..668b8cb9420 100644
--- a/drivers/reset/reset-uclass.c
+++ b/drivers/reset/reset-uclass.c
@@ -323,6 +323,8 @@ struct reset_ctl_bulk *devm_reset_bulk_get_by_node(struct udevice *dev,
 	bulk = devres_alloc(devm_reset_bulk_release,
 			    sizeof(struct reset_ctl_bulk),
 			    __GFP_ZERO);
+
+	/* coverity[RESOURCE_LEAK] */
 	if (unlikely(!bulk))
 		return ERR_PTR(-ENOMEM);
 
-- 
2.31.1.607.g51e8a6a459-goog



More information about the U-Boot mailing list