diff options
| author | Breno Leitao <leitao@linux.vnet.ibm.com> | 2010-10-07 12:40:42 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:20:10 -0400 |
| commit | abf4f6a51477a68fe144b0c62f10c410b0c41378 (patch) | |
| tree | 4631c6d469a746df2fd679ad51dfc9f7203559e8 | |
| parent | 7d172bfefb72a8dae56beff326299c5e21f6f6db (diff) | |
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.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 | |||
| 172 | jsm_uart_port_init here! */ | 172 | jsm_uart_port_init here! */ |
| 173 | dev_err(&pdev->dev, "memory allocation for flipbuf failed\n"); | 173 | dev_err(&pdev->dev, "memory allocation for flipbuf failed\n"); |
| 174 | rc = -ENOMEM; | 174 | rc = -ENOMEM; |
| 175 | goto out_free_irq; | 175 | goto out_free_uart; |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | pci_set_drvdata(pdev, brd); | 178 | pci_set_drvdata(pdev, brd); |
| 179 | pci_save_state(pdev); | 179 | pci_save_state(pdev); |
| 180 | 180 | ||
| 181 | return 0; | 181 | return 0; |
| 182 | out_free_uart: | ||
| 183 | jsm_remove_uart_port(brd); | ||
| 182 | out_free_irq: | 184 | out_free_irq: |
| 183 | jsm_remove_uart_port(brd); | 185 | jsm_remove_uart_port(brd); |
| 184 | free_irq(brd->irq, brd); | 186 | free_irq(brd->irq, brd); |
