memstick: jmb38x_ms: use appropriate free function in jmb38x_ms_alloc_host()
Subsystems (3)
PATCH 1/1 memstick: jmb38x_ms: use appropriate free function in jmb38x_ms_alloc_host()
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 <[email protected]>
--- drivers/memstick/host/jmb38x_ms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memstick/host/jmb38x_ms.c +1 -1
@@ -882,7 +882,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 ; }
Signature · 1 line
2.20.1
Quoted 8 lines · Dan Carpenter
The "msh" pointer is device managed, meaning that
memstick_alloc_host()callsdevice_initialize()on it. That means that it can't be free usingkfree()but must instead be freed withmemstick_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 <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 20 lines
--- drivers/memstick/host/jmb38x_ms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/memstick/host/jmb38x_ms.c +1
-2@@ -882,7 +882,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 ; } --2.20.1