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: 9b78ef0c79 ("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
This commit is contained in:
Yang Yingliang 2022-06-17 09:40:08 +08:00 committed by Miquel Raynal
parent 6f6536a0e3
commit 278811d5a7

View File

@ -219,6 +219,7 @@ static int scpart_parse(struct mtd_info *master,
of_node_put(pp); of_node_put(pp);
free: free:
of_node_put(ofpart_node);
kfree(scpart_map); kfree(scpart_map);
if (res <= 0) if (res <= 0)
kfree(parts); kfree(parts);