diff mbox series

"drivers:Fixed memory leak in /linux/drivers/tty/serial/8250/8250_lpss.c file.

Message ID 20240426021939.1083521-1-lumingyindetect@126.com
State New
Headers show
Series "drivers:Fixed memory leak in /linux/drivers/tty/serial/8250/8250_lpss.c file. | expand

Commit Message

lumingyindetect@126.com April 26, 2024, 2:19 a.m. UTC
From: LuMingYin <11570291+yin-luming@user.noreply.gitee.com>

In the lpss8250_probe function in the file /linux/drivers/tty/serial/8250/8250_lpss.c, there were certain return paths where pci_free_irq_vectors was not called to release memory related to pdev, leading to a memory leak. This commit fixes that issue."

Signed-off-by: LuMingYin <11570291+yin-luming@user.noreply.gitee.com>
---
 drivers/tty/serial/8250/8250_lpss.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
index 776ec1ef29d6..2bb86f9cad5b 100644
--- a/drivers/tty/serial/8250/8250_lpss.c
+++ b/drivers/tty/serial/8250/8250_lpss.c
@@ -344,11 +344,11 @@  static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	uart.port.mapbase = pci_resource_start(pdev, 0);
 	uart.port.membase = pcim_iomap(pdev, 0, 0);
 	if (!uart.port.membase)
-		return -ENOMEM;
+		goto early_err_exit;
 
 	ret = lpss->board->setup(lpss, &uart.port);
 	if (ret)
-		return ret;
+		goto early_err_exit;
 
 	dw8250_setup_port(&uart.port);
 
@@ -367,6 +367,7 @@  static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
 err_exit:
 	lpss->board->exit(lpss);
+early_err_exit:
 	pci_free_irq_vectors(pdev);
 	return ret;
 }