]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
regulator: max20086: Fix refcount leak in max20086_parse_regulators_dt()
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 27 May 2025 05:44:14 +0000 (08:44 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jun 2025 13:32:27 +0000 (15:32 +0200)
commitf74abf2cdd23b380d46ade4061980a4ed260eefd
tree8752797c3c5d30a63d3c1190ca19c9c5e7d4cc2d
parent569972c5bdb839b0eaf8aba6ce76ea0b78e2acf8
regulator: max20086: Fix refcount leak in max20086_parse_regulators_dt()

[ Upstream commit 06118ae36855b7d3d22688298e74a766ccf0cb7a ]

There is a missing call to of_node_put() if devm_kcalloc() fails.
Fix this by changing the code to use cleanup.h magic to drop the
refcount.

Fixes: 6b0cd72757c6 ("regulator: max20086: fix invalid memory access")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/aDVRLqgJWMxYU03G@stanley.mountain
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/regulator/max20086-regulator.c