regulator: plug of_node leak in regulator_register()'s error path
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Wed, 12 Aug 2020 01:31:36 +0000 (03:31 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 17 Aug 2020 12:13:53 +0000 (13:13 +0100)
commitd3c731564e09b6c2ebefcd1344743a91a237d6dc
treee5929389e75bf951855ea427f53792ab60b06a42
parent5c06540165d443c6455123eb48e7f1a9b618ab34
regulator: plug of_node leak in regulator_register()'s error path

By calling device_initialize() earlier and noting that kfree(NULL) is
ok, we can save a bit of code in error handling and plug of_node leak.
Fixed commit already did part of the work.

Fixes: 9177514ce349 ("regulator: fix memory leak on error path of regulator_register()")
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/f5035b1b4d40745e66bacd571bbbb5e4644d21a1.1597195321.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/core.c