]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tty: pty: use guard()s
authorJiri Slaby (SUSE) <jirislaby@kernel.org>
Wed, 19 Nov 2025 10:01:31 +0000 (11:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Nov 2025 17:30:39 +0000 (18:30 +0100)
commit977e75909db72e3ee70483a21aec7d745eef02b7
tree0c89d9ef514428de453b1007ea9ce48efc39a8ab
parent6c84a61ac023d581b4b9fcfa44532eaf15946f56
tty: pty: use guard()s

Use guards in the pty code. This improves readability, makes error
handling easier, and marks locked portions of code explicit. All that
while being sure the lock is unlocked.

pty_set_pktmode() is handled specially -- the conditions are inverted
and return called if conditions unmet. This avoid double nested 'if's.
The variable is renamed to want_pktmode so it is not confused with the
current state of pktmode.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Link: https://patch.msgid.link/20251119100140.830761-2-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/pty.c