clk: at91: keep securam node alive while mapping it
Subsystems (2)
PATCH 1/1 clk: at91: keep securam node alive while mapping it
pmc_register_ops() gets an owned reference to the "atmel,sama5d2-securam" node with of_find_compatible_node(). The success path dropped that reference before passing the node to of_iomap(), leaving of_iomap() to consume a node pointer after the caller had released its reference.
Move of_node_put() after of_iomap() so the node remains referenced for the mapping operation. The unavailable-node error path already releases the reference.
--- drivers/clk/at91/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/at91/pmc.c +1 -1
@@ -180,9 +180,9 @@ static int __init pmc_register_ops(void)of_node_put (np);return -ENODEV ; } -of_node_put (np); at91_pmc_backup_suspend =of_iomap (np,0 ); +of_node_put (np);if (!at91_pmc_backup_suspend) {pr_warn ("%s(): unable to map securam\n" , __func__);return -ENOMEM ;
Signature · 1 line
2.43.0
Quoted 6 lines · Yuho Choi
pmc_register_ops()gets an owned reference to the "atmel,sama5d2-securam" node withof_find_compatible_node(). The success path dropped that reference before passing the node toof_iomap(), leavingof_iomap()to consume a node pointer after the caller had released its reference.
Quoted 6 lines
Move
of_node_put()afterof_iomap()so the node remains referenced for the mapping operation. The unavailable-node error path already releases the reference.Fixes 4d21be864092 ("clk: at91: pmc: execute suspend/resume only for backup mode")Signed-off-by Yuho Choi <[email protected]>
Quoted 22 lines
--- drivers/clk/at91/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/at91/pmc.c +1
-1@@ -180,9 +180,9 @@ static int __init pmc_register_ops(void)of_node_put (np);return -ENODEV ; } -of_node_put (np); at91_pmc_backup_suspend =of_iomap (np,0 ); +of_node_put (np);if (!at91_pmc_backup_suspend) {pr_warn ("%s(): unable to map securam\n" , __func__);return -ENOMEM ;Signature · 1 line
2.43.0
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 6 lines · Yuho Choi
pmc_register_ops()gets an owned reference to the "atmel,sama5d2-securam" node withof_find_compatible_node(). The success path dropped that reference before passing the node toof_iomap(), leavingof_iomap()to consume a node pointer after the caller had released its reference.
Quoted 6 lines
Move
of_node_put()afterof_iomap()so the node remains referenced for the mapping operation. The unavailable-node error path already releases the reference.Fixes 4d21be864092 ("clk: at91: pmc: execute suspend/resume only for backup mode")Signed-off-by Yuho Choi <[email protected]>
Claudiu Beznea
maintainerQuoted 6 lines · Yuho Choi
pmc_register_ops()gets an owned reference to the "atmel,sama5d2-securam" node withof_find_compatible_node(). The success path dropped that reference before passing the node toof_iomap(), leavingof_iomap()to consume a node pointer after the caller had released its reference.
Quoted 6 lines
Move
of_node_put()afterof_iomap()so the node remains referenced for the mapping operation. The unavailable-node error path already releases the reference.Fixes 4d21be864092 ("clk: at91: pmc: execute suspend/resume only for backup mode")Signed-off-by Yuho Choi<[email protected]>
Missed to mention, applied to clk-microchip-fixes, thanks!