summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdun Nihaal <nihaal@cse.iitm.ac.in>2026-01-20 13:26:20 +0300
committerLee Jones <lee@kernel.org>2026-03-25 15:44:43 +0300
commita5a65a7fb2f7796bbe492cd6be59c92cb64377d1 (patch)
tree822235bf92159916a8f97639af17a09bf8bdaf3c
parent1dfc9d60a69ec148e1cb709256617d86e5f0e8f8 (diff)
downloadlinux-a5a65a7fb2f7796bbe492cd6be59c92cb64377d1.tar.xz
mfd: mc13xxx-core: Fix memory leak in mc13xxx_add_subdevice_pdata()
The memory allocated for cell.name using kmemdup() is not freed when mfd_add_devices() fails. Fix that by using devm_kmemdup(). Fixes: 8e00593557c3 ("mfd: Add mc13892 support to mc13xxx") Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in> Link: https://patch.msgid.link/20260120102622.66921-1-nihaal@cse.iitm.ac.in Signed-off-by: Lee Jones <lee@kernel.org>
-rw-r--r--drivers/mfd/mc13xxx-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 920797b806ce..786eab3b2d03 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -377,7 +377,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
if (snprintf(buf, sizeof(buf), format, name) > sizeof(buf))
return -E2BIG;
- cell.name = kmemdup(buf, strlen(buf) + 1, GFP_KERNEL);
+ cell.name = devm_kmemdup(mc13xxx->dev, buf, strlen(buf) + 1, GFP_KERNEL);
if (!cell.name)
return -ENOMEM;