The device node iterators perform an of_node_get on each iteration, so a
jump out of the loop requires an of_node_put.
The of_find_device_by_node() takes a reference to the underlying device
structure, we also should release that reference.
This patch fixes those 2 issues.
Fixes: 75081322c ("sparc32: Convert PC RTC probing to pure OF driver")
Signed-off-by: Wen Yang <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: [email protected]
---
drivers/char/rtc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index c862d0b..aa67690 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -872,6 +872,8 @@ static int __init rtc_init(void)
if (op) {
rtc_port = op->resource[0].start;
rtc_irq = op->irqs[0];
+ put_device(&op->dev);
+ of_node_put(dp);
goto found;
}
}
--
2.9.5