From: Ji-Hun Kim <ji_hun.kim@samsung.com>
To: gregkh@linuxfoundation.org, baijiaju1990@gmail.com,
forest@alittletooquiet.net
Cc: devel@driverdev.osuosl.org, y.k.oh@samsung.com,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
julia.lawall@lip6.fr, ji_hun.kim@samsung.com,
santhameena13@gmail.com
Subject: [PATCH v4 2/2] staging: vt6655: add handling memory leak on vnt_start()
Date: Fri, 30 Mar 2018 14:51:55 +0900 [thread overview]
Message-ID: <1522389115-1124-2-git-send-email-ji_hun.kim@samsung.com> (raw)
In-Reply-To: <1522389115-1124-1-git-send-email-ji_hun.kim@samsung.com>
There was no code for handling memory leaks of device_init_rings() and
request_irq(). It needs to free allocated memory in the device_init_rings()
, when request_irq() is failed. Add freeing sequences of irq and device
init rings.
Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com>
---
It's additional memory leak handling patch from
[PATCH v4 1/2] staging: vt6655: check for memory allocation failures
drivers/staging/vt6655/device_main.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index c9752df..3604f2d 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1194,14 +1194,17 @@ static int vnt_start(struct ieee80211_hw *hw)
int ret;
priv->rx_buf_sz = PKT_BUF_SZ;
- if (!device_init_rings(priv))
- return -ENOMEM;
+ ret = (int)device_init_rings(priv);
+ if (!ret) {
+ ret = -ENOMEM;
+ goto err_init_rings;
+ }
ret = request_irq(priv->pcid->irq, vnt_interrupt,
IRQF_SHARED, "vt6655", priv);
if (ret) {
dev_dbg(&priv->pcid->dev, "failed to start irq\n");
- return ret;
+ goto err_irq;
}
dev_dbg(&priv->pcid->dev, "call device init rd0 ring\n");
@@ -1234,6 +1237,10 @@ static int vnt_start(struct ieee80211_hw *hw)
err_init_rd1_ring:
device_free_rd0_ring(priv);
err_init_rd0_ring:
+ free_irq(priv->pcid->irq, priv);
+err_irq:
+ device_free_rings(priv);
+err_init_rings:
return ret;
}
--
1.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2018-03-30 5:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20180330055207epcas1p14d562f44802bac86a8a7cd95fe2d009f@epcas1p1.samsung.com>
2018-03-30 5:51 ` [PATCH v4 1/2] staging: vt6655: check for memory allocation failures Ji-Hun Kim
[not found] ` <CGME20180330055211epcas2p1a75c707cdf600cfd5027e253ef440861@epcas2p1.samsung.com>
2018-03-30 5:51 ` Ji-Hun Kim [this message]
2018-04-03 11:18 ` [PATCH v4 2/2] staging: vt6655: add handling memory leak on vnt_start() Dan Carpenter
2018-04-01 2:42 ` [PATCH v4 1/2] staging: vt6655: check for memory allocation failures Jia-Ju Bai
2018-04-03 11:12 ` Dan Carpenter
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=1522389115-1124-2-git-send-email-ji_hun.kim@samsung.com \
--to=ji_hun.kim@samsung.com \
--cc=baijiaju1990@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=forest@alittletooquiet.net \
--cc=gregkh@linuxfoundation.org \
--cc=julia.lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=santhameena13@gmail.com \
--cc=y.k.oh@samsung.com \
/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).