diff mbox series

fix memory leak in pci_bus_set_aer_ops

Message ID 20240314061945.1324128-1-zzjas98@gmail.com
State New
Headers show
Series fix memory leak in pci_bus_set_aer_ops | expand

Commit Message

Zijie Zhao March 14, 2024, 6:19 a.m. UTC
Remove unnecessary bus_ops = NULL assignment in pci_bus_set_aer_ops to
prevent a memory leak when ops are equal to &aer_inj_pci_ops. This change
ensures allocated bus_ops memory is properly freed.

Signed-off-by: Zijie Zhao <zzjas98@gmail.com>
---
 drivers/pci/pcie/aer_inject.c | 1 -
 1 file changed, 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/pci/pcie/aer_inject.c b/drivers/pci/pcie/aer_inject.c
index 2dab275d252f..0c84fadbfd2e 100644
--- a/drivers/pci/pcie/aer_inject.c
+++ b/drivers/pci/pcie/aer_inject.c
@@ -309,7 +309,6 @@  static int pci_bus_set_aer_ops(struct pci_bus *bus)
 		goto out;
 	pci_bus_ops_init(bus_ops, bus, ops);
 	list_add(&bus_ops->list, &pci_bus_ops_list);
-	bus_ops = NULL;
 out:
 	spin_unlock_irqrestore(&inject_lock, flags);
 	kfree(bus_ops);