summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBreno Leitao <leitao@linux.vnet.ibm.com>2010-10-07 13:40:42 -0300
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-22 10:20:10 -0700
commitabf4f6a51477a68fe144b0c62f10c410b0c41378 (patch)
tree4631c6d469a746df2fd679ad51dfc9f7203559e8
parent7d172bfefb72a8dae56beff326299c5e21f6f6db (diff)
downloadlinux-3.10-abf4f6a51477a68fe144b0c62f10c410b0c41378.tar.gz
linux-3.10-abf4f6a51477a68fe144b0c62f10c410b0c41378.tar.bz2
linux-3.10-abf4f6a51477a68fe144b0c62f10c410b0c41378.zip
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 <leitao@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/serial/jsm/jsm_driver.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
index eaf54501411..18f548449c6 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);