mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
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: 8e00593557 ("mfd: Add mc13892 support to mc13xxx")
Signed-off-by: Abdun Nihaal <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Lee Jones <[email protected]>
This commit is contained in:
1 parent
1dfc9d60a6
commit
a5a65a7fb2
1 file changed
+1
-1
@@ -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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user