[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <811062614da5ec63ac9c975b77bdb6bf34720552.1694985959.git.mirq-linux@rere.qmqm.pl>
Date: Sun, 17 Sep 2023 23:35:14 +0200
From: Michał Mirosław <mirq-linux@...e.qmqm.pl>
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>
Cc: Vladimir Zapolskiy <vz@...ia.com>,
Zeng Heng <zengheng4@...wei.com>, linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] regulator/core: regulator_register: set device->class
earlier
device_initialize() calls for the `device` struct be freed with
`put_device()`. This requires a release() callback that is provided by
the regulator_class.
Fixes: d3c731564e09 ("regulator: plug of_node leak in regulator_register()'s error path")
Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
---
drivers/regulator/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index d8e1caaf207e..2f6ee5527cb0 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -5542,6 +5542,7 @@ regulator_register(struct device *dev,
goto rinse;
}
device_initialize(&rdev->dev);
+ rdev->dev.class = ®ulator_class;
spin_lock_init(&rdev->err_lock);
/*
@@ -5603,7 +5604,6 @@ regulator_register(struct device *dev,
rdev->supply_name = regulator_desc->supply_name;
/* register with sysfs */
- rdev->dev.class = ®ulator_class;
rdev->dev.parent = config->dev;
dev_set_name(&rdev->dev, "regulator.%lu",
(unsigned long) atomic_inc_return(®ulator_no));
--
2.39.2
Powered by blists - more mailing lists