mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
mfd: sm501: Fix potential memory leaks during remove
The memory allocated for struct sm501_devdata in sm501_pci_probe() and
sm501_plat_probe() is not freed by the corresponding remove functions
sm501_pci_remove() and sm501_plat_remove(). Fix that by adding a call to
kfree().
Fixes: b6d6454fdb ("[PATCH] mfd: SM501 core driver")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Link: https://patch.msgid.link/20260720113836.73133-1-nihaal@cse.iitm.ac.in
Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
d97a98f434
commit
83feedd9d8
|
|
@ -1627,6 +1627,7 @@ static void sm501_pci_remove(struct pci_dev *dev)
|
|||
release_mem_region(sm->io_res->start, 0x100);
|
||||
|
||||
pci_disable_device(dev);
|
||||
kfree(sm);
|
||||
}
|
||||
|
||||
static void sm501_plat_remove(struct platform_device *dev)
|
||||
|
|
@ -1637,6 +1638,7 @@ static void sm501_plat_remove(struct platform_device *dev)
|
|||
iounmap(sm->regs);
|
||||
|
||||
release_mem_region(sm->io_res->start, 0x100);
|
||||
kfree(sm);
|
||||
}
|
||||
|
||||
static const struct pci_device_id sm501_pci_tbl[] = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user