* [PATCH] jsm: Remove the uart port on errors
@ 2010-10-04 0:57 Breno Leitao
0 siblings, 0 replies; 2+ messages in thread
From: Breno Leitao @ 2010-10-04 0:57 UTC (permalink / raw)
To: linux-serial; +Cc: Scott.Kilau, Breno Leitao
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>
---
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 eaf5450..18f5484 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);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] jsm: Remove the uart port on errors
@ 2010-10-07 16:40 Breno Leitao
0 siblings, 0 replies; 2+ messages in thread
From: Breno Leitao @ 2010-10-07 16:40 UTC (permalink / raw)
To: greg; +Cc: linux-serial, Breno Leitao
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>
---
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 eaf5450..18f5484 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);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-07 16:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-07 16:40 [PATCH] jsm: Remove the uart port on errors Breno Leitao
-- strict thread matches above, loose matches on Subject: below --
2010-10-04 0:57 Breno Leitao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).