mtd: maps: Fix refcount leak in ap_flash_init
PATCH 1/1 mtd: maps: Fix refcount leak in ap_flash_init
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
Fixes b0afd44bc192 ("mtd: physmap_of: add a hook for Versatile write protection")
Signed-off-by Miaoqian Lin <[email protected]>
--- drivers/mtd/maps/physmap-versatile.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/maps/physmap-versatile.c +1 -0
@@ -93,6 +93,7 @@ static int ap_flash_init(struct platform_device *pdev)return -ENODEV ; } ebi_base =of_iomap (ebi,0 ); +of_node_put (ebi);if (!ebi_base)return -ENODEV ;
Signature · 1 line
2.25.1
Quoted 6 lines · Miaoqian Lin
of_find_matching_node()returns a node pointer with refcount incremented, we should useof_node_put()on it when not need anymore. Add missingof_node_put()to avoid refcount leak.Fixes b0afd44bc192 ("mtd: physmap_of: add a hook for Versatile write protection")Signed-off-by Miaoqian Lin <[email protected]>
Reviewed-by Linus Walleij <[email protected]>
Yours,
Linus Walleij
Quoted 7 lines · Miaoqian Lin
of_find_matching_node()returns a node pointer with refcount incremented, we should useof_node_put()on it when not need anymore. Add missingof_node_put()to avoid refcount leak.Fixes b0afd44bc192 ("mtd: physmap_of: add a hook for Versatile write protection")Signed-off-by Miaoqian Lin <[email protected]>Reviewed-by Linus Walleij <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel