# \[PATCH\] drivers/tty: add missing of\_node\_put()

- Subsystems: TTY LAYER AND SERIAL DRIVERS, SPARC SERIAL DRIVERS, THE REST
- Maintainers: Greg Kroah-Hartman, Jiri Slaby, David S. Miller, Linus Torvalds
- List: linux-serial
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-serial/2018/11/5440421/t

## \[PATCH\] drivers/tty: add missing of\_node\_put()

- From: Yangtao Li \<tiny.windzz@gmail.com\>
- Date: 2018-11-21 15:23:01 
- Message: https://ratatoskr.run/linux-serial/2018/11/5440421.md

```text
of_find_node_by_path() acquires a reference to the node
returned by it and that reference needs to be dropped by its caller.
This place is not doing this, so fix it.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/tty/serial/suncore.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/suncore.c b/drivers/tty/serial/suncore.c
index 70a4ea4eaa6e..990376576970 100644
--- a/drivers/tty/serial/suncore.c
+++ b/drivers/tty/serial/suncore.c
@@ -112,6 +112,7 @@ void sunserial_console_termios(struct console *con, struct device_node *uart_dp)
 		mode = of_get_property(dp, mode_prop, NULL);
 		if (!mode)
 			mode = "9600,8,n,1,-";
+		of_node_put(dp);
 	}
 
 	cflag = CREAD | HUPCL | CLOCAL;
-- 
2.17.0
```

## Re: \[PATCH\] drivers/tty: add missing of\_node\_put()

- From: David Miller \<davem@davemloft.net\>
- Date: 2018-12-03 04:55:56 
- Message: https://ratatoskr.run/linux-serial/2018/12/5450481.md

```text
From: Yangtao Li <tiny.windzz@gmail.com>
Date: Wed, 21 Nov 2018 10:22:54 -0500

> of_find_node_by_path() acquires a reference to the node
> returned by it and that reference needs to be dropped by its caller.
> This place is not doing this, so fix it.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

Applied.
```
