Commit dc8d006d authored by Wang ShaoBo's avatar Wang ShaoBo Committed by Mark Brown

regulator: core: use kfree_const() to free space conditionally

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: 87fe29b6 ("regulator: push allocations in create_regulator() outside of lock")
Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
Link: https://lore.kernel.org/r/20221123034616.3609537-1-bobo.shaobowang@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 149f5266
......@@ -1813,7 +1813,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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment