From 126f33704d9df79199e6162be5b8227199b72d82 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 11 Jun 2020 10:26:00 +0100 Subject: [PATCH] mfd: core: Fix memory leak of 'cell' When creating a platform device from an MFD cell description, we allocate some memory and make a copy which is then stored inside the platform_device's structure. However, care is not currently taken to free the allocated memory when the platform device is torn down. This patch takes care of the leak. Signed-off-by: Lee Jones --- drivers/mfd/mfd-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 720e5c8b1588c..6087e4f29d078 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -297,7 +297,10 @@ static int mfd_remove_devices_fn(struct device *dev, void *data) regulator_bulk_unregister_supply_alias(dev, cell->parent_supplies, cell->num_parent_supplies); + kfree(cell); + platform_device_unregister(pdev); + return 0; }