[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1522912160-21009-2-git-send-email-ji_hun.kim@samsung.com>
Date: Thu, 05 Apr 2018 16:09:20 +0900
From: Ji-Hun Kim <ji_hun.kim@...sung.com>
To: dan.carpenter@...cle.com, gregkh@...uxfoundation.org,
baijiaju1990@...il.com, forest@...ttletooquiet.net
Cc: dartnorris@...il.com, santhameena13@...il.com,
julia.lawall@...6.fr, ji_hun.kim@...sung.com, y.k.oh@...sung.com,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH v5 2/2] staging: vt6655: add handling memory leak on
vnt_start()
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() would be failed. Add freeing sequences of irq and
device init rings.
Signed-off-by: Ji-Hun Kim <ji_hun.kim@...sung.com>
---
It's additional memory leak handling patch from the
[PATCH v5 1/2] staging: vt6655: check for memory allocation failures
Changes v2:
- Change label names following coding-style conventions.
- Remove uneccessary goto, just return error number like original code.
drivers/staging/vt6655/device_main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 700c03c..1ab0e85 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1237,13 +1237,13 @@ static int vnt_start(struct ieee80211_hw *hw)
IRQF_SHARED, "vt6655", priv);
if (ret) {
dev_dbg(&priv->pcid->dev, "failed to start irq\n");
- return ret;
+ goto err_free_rings;
}
dev_dbg(&priv->pcid->dev, "call device init rd0 ring\n");
ret = device_init_rd0_ring(priv);
if (ret)
- return ret;
+ goto err_free_irq;
ret = device_init_rd1_ring(priv);
if (ret)
goto err_free_rd0_ring;
@@ -1269,6 +1269,10 @@ static int vnt_start(struct ieee80211_hw *hw)
device_free_rd1_ring(priv);
err_free_rd0_ring:
device_free_rd0_ring(priv);
+err_free_irq:
+ free_irq(priv->pcid->irq, priv);
+err_free_rings:
+ device_free_rings(priv);
return ret;
}
--
1.9.1
Powered by blists - more mailing lists