diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2023-09-19 01:50:26 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-09-26 18:26:07 +0300 |
commit | 8adb4e647a83cb5928c05dae95b010224aea0705 (patch) | |
tree | 305db1bd092ca38cff0b63f0ef9ac7b63c1bc247 /drivers/usb/cdns3/cdns3-ti.c | |
parent | 7e37c851374eca2d1f6128de03195c9f7b4baaf2 (diff) | |
download | linux-8adb4e647a83cb5928c05dae95b010224aea0705.tar.xz |
regulator/core: regulator_register: set device->class earlier
When fixing a memory leak in commit d3c731564e09 ("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 5f4b204b6b81 "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: d3c731564e09 ("regulator: plug of_node leak in regulator_register()'s error path")
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/b5b19cb458c40c9d02f3d5a7bd1ba7d97ba17279.1695077303.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-ti.c')
0 files changed, 0 insertions, 0 deletions