summaryrefslogtreecommitdiff
path: root/drivers/memstick
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2021-10-11 15:39:12 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-11-17 09:48:37 +0100
commit9498f5272a44a93edffb5f3289550670598d7ef8 (patch)
treeb2a1749e79b2545f891ab00e98702e6845cf0ae6 /drivers/memstick
parent5f462b38ce7a233f2da45b8d463362d032f490d8 (diff)
memstick: jmb38x_ms: use appropriate free function in jmb38x_ms_alloc_host()
[ Upstream commit beae4a6258e64af609ad5995cc6b6056eb0d898e ] The "msh" pointer is device managed, meaning that memstick_alloc_host() calls device_initialize() on it. That means that it can't be free using kfree() but must instead be freed with memstick_free_host(). Otherwise it leads to a tiny memory leak of device resources. Fixes: 60fdd931d577 ("memstick: add support for JMicron jmb38x MemoryStick host controller") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20211011123912.GD15188@kili Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/memstick')
-rw-r--r--drivers/memstick/host/jmb38x_ms.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c
index 64fff6abe60e..74d6686b35f7 100644
--- a/drivers/memstick/host/jmb38x_ms.c
+++ b/drivers/memstick/host/jmb38x_ms.c
@@ -899,7 +899,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt)
iounmap(host->addr);
err_out_free:
- kfree(msh);
+ memstick_free_host(msh);
return NULL;
}