[PATCH 0/2] regulator/core: A quick fix for struct device handling

From: Michał Mirosław
Date: Sun Sep 17 2023 - 17:41:32 EST


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()") and introducing a different bug: now
early error paths use kfree(dev) instead of put_device() for an already
initialized struct device.

This series fixes the original bug and reverts the problematic fix.

Michał Mirosław (2):
regulator/core: regulator_register: set device->class earlier
Revert "regulator: core: fix kobject release warning and memory leak
in regulator_register()"

drivers/regulator/core.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

--
2.39.2