]> git.baikalelectronics.ru Git - kernel.git/commit
regulator: fix memory leak with repeated set_machine_constraints()
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Fri, 13 Nov 2020 00:20:27 +0000 (01:20 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 13 Nov 2020 14:21:24 +0000 (14:21 +0000)
commit508a0645c31aea9b683f5f2c50ca61a5006f369f
treed850a7f7bc007fef134fe0a6d1e1b1762705d026
parentdf63a655dcfc5dc029fe210f7341c4f48f21252c
regulator: fix memory leak with repeated set_machine_constraints()

Fixed commit introduced a possible second call to
set_machine_constraints() and that allocates memory for
rdev->constraints. Move the allocation to the caller so
it's easier to manage and done once.

Fixes: bbe1299acdc1 ("regulator: resolve supply after creating regulator")
Cc: stable@vger.kernel.org
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> # stpmic1
Link: https://lore.kernel.org/r/78c3d4016cebc08d441aad18cb924b4e4d9cf9df.1605226675.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/core.c