summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-mem.c
diff options
context:
space:
mode:
authorBoris Brezillon <bbrezillon@kernel.org>2019-01-19 15:57:57 +0100
committerMark Brown <broonie@kernel.org>2019-01-21 18:57:14 +0100
commitbfecfd6e23bf677c85828eb20fa4b13a18bffe23 (patch)
tree818c65255f644de45463589a02ef38d3d056cac1 /drivers/spi/spi-mem.c
parentspi: spi-mem: Fix spi_mem_dirmap_destroy() kerneldoc (diff)
downloadlinux-bfecfd6e23bf677c85828eb20fa4b13a18bffe23.tar.xz
linux-bfecfd6e23bf677c85828eb20fa4b13a18bffe23.zip
spi: spi-mem: Fix a memory leak in spi_mem_dirmap_destroy()
The dirmap descriptor object allocated in spi_mem_dirmap_create is never freed. Add a kfree(desc) in spi_mem_dirmap_destroy(). Fixes: aa167f3fed0c ("spi: spi-mem: Add a new API to support direct mapping") Signed-off-by: Boris Brezillon <bbrezillon@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-mem.c')
-rw-r--r--drivers/spi/spi-mem.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 08ba43506e81..9487c9cd68bd 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -547,6 +547,8 @@ void spi_mem_dirmap_destroy(struct spi_mem_dirmap_desc *desc)
if (!desc->nodirmap && ctlr->mem_ops && ctlr->mem_ops->dirmap_destroy)
ctlr->mem_ops->dirmap_destroy(desc);
+
+ kfree(desc);
}
EXPORT_SYMBOL_GPL(spi_mem_dirmap_destroy);