summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-06-17 03:40:08 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2022-06-17 08:29:50 +0200
commit278811d5a7b2af4e737c88ab3137d3ccc0732ac1 (patch)
tree6b61244572c2af398960888a62f89190fab7fc5e /drivers/mtd
parentmtd: st_spi_fsm: Simplify error checking in .probe() a bit (diff)
downloadlinux-278811d5a7b2af4e737c88ab3137d3ccc0732ac1.tar.xz
linux-278811d5a7b2af4e737c88ab3137d3ccc0732ac1.zip
mtd: parsers: scpart: add missing of_node_put() in scpart_parse()
of_get_child_by_name() will increase the refcount of 'ofpart_node', so add of_node_put() after using it to avoid refcount leak. Fixes: 9b78ef0c7997 ("mtd: parsers: add support for Sercomm partitions") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220617014008.851583-1-yangyingliang@huawei.com
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/parsers/scpart.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mtd/parsers/scpart.c b/drivers/mtd/parsers/scpart.c
index bc40e25dc105..02601bb33de4 100644
--- a/drivers/mtd/parsers/scpart.c
+++ b/drivers/mtd/parsers/scpart.c
@@ -219,6 +219,7 @@ static int scpart_parse(struct mtd_info *master,
of_node_put(pp);
free:
+ of_node_put(ofpart_node);
kfree(scpart_map);
if (res <= 0)
kfree(parts);