summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorWang ShaoBo <bobo.shaobowang@huawei.com>2022-11-23 06:46:16 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-14 12:15:31 +0300
commita065be02433e0bfb053789be23df028b317f9b56 (patch)
treed1c0cae219b4fa8947f7525e880ba206134838b7 /drivers/regulator
parentd7198b63cbeeb8b4b9fa6dfe0a39074d49513f4f (diff)
downloadlinux-a065be02433e0bfb053789be23df028b317f9b56.tar.xz
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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 876afa3919c1..60c0be2ea5c5 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1645,7 +1645,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
regulator = kzalloc(sizeof(*regulator), GFP_KERNEL);
if (regulator == NULL) {
- kfree(supply_name);
+ kfree_const(supply_name);
return NULL;
}