[PATCH] regulator: fix memory leak #2

Sascha Hauer s.hauer at pengutronix.de
Tue Mar 1 00:46:38 PST 2022


Fix memory leak of propname.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/regulator/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index d3c43ce9a3..827ccee9d5 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -197,14 +197,14 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c
 	struct device_node *node, *node_parent;
 	int ret;
 
-	propname = basprintf("%s-supply", supply);
-
 	/*
 	 * If the device does have a device node return the dummy regulator.
 	 */
 	if (!dev->device_node)
 		return NULL;
 
+	propname = basprintf("%s-supply", supply);
+
 	/*
 	 * If the device node does not contain a supply property, this device doesn't
 	 * need a regulator. Return the dummy regulator in this case.
-- 
2.30.2




More information about the barebox mailing list