staging: dgnc: delete successive assignments to the same location
authorJiayi Ye <yejiayily@gmail.com>
Sat, 25 Oct 2014 12:04:17 +0000 (20:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Oct 2014 07:41:43 +0000 (15:41 +0800)
Successive assignments to the same location is meaningless and can be
deleted. The Coccinelle semantic patch was used to find cases.

@@
expression e1,e2,e3;
@@

(
 (<+...e1++...+>)=e2;
|
 (<+...e1--...+>)=e2;
|
 (<+...++e1...+>)=e2;
|
 (<+...--e1...+>)=e2;
|
e1=e2;
e1 = <+...e1...+>;
|
*e1=e2;
*e1=e3;
)

Signed-off-by: Jiayi Ye <yejiayily@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dgnc/dgnc_tty.c

index 8384e3d..f81a375 100644 (file)
@@ -2205,8 +2205,6 @@ static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command, uns
        if (!bd || bd->magic != DGNC_BOARD_MAGIC)
                return ret;
 
-       ret = 0;
-
        ret = get_user(arg, value);
        if (ret)
                return ret;