[PATCHv2,3/3] tty: Make unlock_pty() inline void

Submitted by Radostin Stoyanov on Nov. 17, 2018, 11:53 a.m.

Details

Message ID 20181117115329.16424-3-rstoyanov1@gmail.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Radostin Stoyanov Nov. 17, 2018, 11:53 a.m.
The return value of unlock_pty() is not needed because if the unlock
fails then futher operations on locked entry will fail as well.
unlock_pty() will only yield the error message.

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
---
 criu/tty.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/tty.c b/criu/tty.c
index 38e1cab3..fe126f18 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -655,7 +655,7 @@  static int pty_open_ptmx_index(struct file_desc *d, struct tty_info *info, int f
 					open_tty_reg, d, path_from_reg(d));
 }
 
-static int unlock_pty(int fd)
+static void inline unlock_pty(int fd)
 {
 	const int lock = 0;
 
@@ -664,12 +664,8 @@  static int unlock_pty(int fd)
 	 * by kernel and we need to unlock it to be
 	 * able to connect slave peer.
 	 */
-	if (ioctl(fd, TIOCSPTLCK, &lock)) {
+	if (ioctl(fd, TIOCSPTLCK, &lock))
 		pr_err("Unable to unlock pty device via y%d\n", fd);
-		return -1;
-	}
-
-	return 0;
 }
 
 static int lock_pty(int fd)

Comments

Cyrill Gorcunov Nov. 17, 2018, 12:38 p.m.
On Sat, Nov 17, 2018 at 11:53:29AM +0000, Radostin Stoyanov wrote:
> The return value of unlock_pty() is not needed because if the unlock
> fails then futher operations on locked entry will fail as well.
> unlock_pty() will only yield the error message.
> 
> Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>

Thanks!