aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/vt/selection.c
diff options
context:
space:
mode:
authorGustavo A. R. Silva <garsilva@embeddedor.com>2017-11-10 16:05:45 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-11-28 15:32:32 +0100
commitdf3d9a5b771fa40689bbbdf54bd575d2817fe028 (patch)
treef8a81a35fb2a8f048ef73bbc0f4a5c0e048158d4 /drivers/tty/vt/selection.c
parentLinux 4.15-rc1 (diff)
downloadlinux-dev-df3d9a5b771fa40689bbbdf54bd575d2817fe028.tar.xz
linux-dev-df3d9a5b771fa40689bbbdf54bd575d2817fe028.zip
tty: vt: replace _manual_ swap with swap macro in set_selection
Make use of the swap macro instead of _manually_ swapping values and remove unnecessary variable tmp. This makes the code easier to read and maintain. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt/selection.c')
-rw-r--r--drivers/tty/vt/selection.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index af4da9507180..7851383fbd6c 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -186,11 +186,7 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t
}
if (ps > pe) /* make sel_start <= sel_end */
- {
- int tmp = ps;
- ps = pe;
- pe = tmp;
- }
+ swap(ps, pe);
if (sel_cons != vc_cons[fg_console].d) {
clear_selection();