regulator: core: use kfree_const() to free space conditionally
authorWang ShaoBo <bobo.shaobowang@huawei.com>
Wed, 23 Nov 2022 03:46:16 +0000 (11:46 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:11 +0000 (13:14 +0100)
commit27aac5c012462e6095997c127461b4d460c90c5f
tree477d2f1585430aadf6579bf1e66ce2d55808022e
parenta69b1faa9b14e94e573ce740a4719a385b5a89c4
regulator: core: use kfree_const() to free space conditionally

[ Upstream commit dc8d006d15b623c1d80b90b45d6dcb6e890dad09 ]

Use kfree_const() to free supply_name conditionally in create_regulator()
as supply_name may be allocated from kmalloc() or directly from .rodata
section.

Fixes: 87fe29b61f95 ("regulator: push allocations in create_regulator() outside of lock")
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
Link: https://lore.kernel.org/r/20221123034616.3609537-1-bobo.shaobowang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/regulator/core.c