Skip to content

Commit

Permalink
jsm: Remove the uart port on errors
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Breno Leitao authored and Greg Kroah-Hartman committed Oct 22, 2010
1 parent 7d172bf commit abf4f6a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/serial/jsm/jsm_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit abf4f6a

Please sign in to comment.