Commit beae4a62 authored by Dan Carpenter's avatar Dan Carpenter Committed by Ulf Hansson

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: 60fdd931 ("memstick: add support for JMicron jmb38x MemoryStick host controller")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211011123912.GD15188@kiliSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 8105c2ab
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment