Messages in this thread Patch in this message | | | From | Wen Yang <> | Subject | [RESEND PATCH] char/rtc: fix object reference leaks in rtc_init | Date | Thu, 24 Jan 2019 09:35:16 +0800 |
| |
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 <wen.yang99@zte.com.cn> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: David S. Miller <davem@davemloft.net> Cc: linux-kernel@vger.kernel.org --- 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
| |