From: Breno Leitao Date: Thu, 7 Oct 2010 16:40:42 +0000 (-0300) Subject: jsm: Remove the uart port on errors X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=abf4f6a51477a68fe144b0c62f10c410b0c41378;p=linux-beck.git jsm: Remove the uart port on errors If kzmalloc fails, the uart port is not removed causing a leak. This patch just add another label that removes the uart when the kzmalloc fails. Signed-off-by: Breno Leitao Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c index eaf545014119..18f548449c63 100644 --- a/drivers/serial/jsm/jsm_driver.c +++ b/drivers/serial/jsm/jsm_driver.c @@ -172,13 +172,15 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_device jsm_uart_port_init here! */ dev_err(&pdev->dev, "memory allocation for flipbuf failed\n"); rc = -ENOMEM; - goto out_free_irq; + goto out_free_uart; } pci_set_drvdata(pdev, brd); pci_save_state(pdev); return 0; + out_free_uart: + jsm_remove_uart_port(brd); out_free_irq: jsm_remove_uart_port(brd); free_irq(brd->irq, brd);