Commit 8adb4e6
regulator/core: regulator_register: set device->class earlier
When fixing a memory leak in commit d3c7315 ("regulator: plug
of_node leak in regulator_register()'s error path") it moved the
device_initialize() call earlier, but did not move the `dev->class`
initialization. The bug was spotted and fixed by reverting part of
the commit (in commit 5f4b204 "regulator: core: fix kobject
release warning and memory leak in regulator_register()") but
introducing a different bug: now early error paths use `kfree(dev)`
instead of `put_device()` for an already initialized `struct device`.
Move the missing assignments to just after `device_initialize()`.
Fixes: d3c7315 ("regulator: plug of_node leak in regulator_register()'s error path")
Signed-off-by: Michał Mirosław <[email protected]>
Link: https://lore.kernel.org/r/b5b19cb458c40c9d02f3d5a7bd1ba7d97ba17279.1695077303.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <[email protected]>1 parent 7e37c85 commit 8adb4e6
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5542 | 5542 | | |
5543 | 5543 | | |
5544 | 5544 | | |
| 5545 | + | |
| 5546 | + | |
5545 | 5547 | | |
5546 | 5548 | | |
5547 | 5549 | | |
| |||
5603 | 5605 | | |
5604 | 5606 | | |
5605 | 5607 | | |
5606 | | - | |
5607 | 5608 | | |
5608 | 5609 | | |
5609 | 5610 | | |
5610 | | - | |
5611 | 5611 | | |
5612 | 5612 | | |
5613 | 5613 | | |
| |||
0 commit comments