From: Breno Leitao <leitao@linux.vnet.ibm.com>
To: greg@kroah.com
Cc: linux-serial@vger.kernel.org, Breno Leitao <leitao@linux.vnet.ibm.com>
Subject: [PATCH] jsm: Remove the uart port on errors
Date: Thu, 7 Oct 2010 13:40:42 -0300 [thread overview]
Message-ID: <1286469642-18796-1-git-send-email-leitao@linux.vnet.ibm.com> (raw)
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
next reply other threads:[~2010-10-07 16:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 16:40 Breno Leitao [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-10-04 0:57 [PATCH] jsm: Remove the uart port on errors Breno Leitao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1286469642-18796-1-git-send-email-leitao@linux.vnet.ibm.com \
--to=leitao@linux.vnet.ibm.com \
--cc=greg@kroah.com \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).