tty: vt: replace _manual_ swap with swap macro in set_selection
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Fri, 10 Nov 2017 22:05:45 +0000 (16:05 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2017 14:32:32 +0000 (15:32 +0100)
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>
drivers/tty/vt/selection.c

index af4da95..7851383 100644 (file)
@@ -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();