]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Staging: gdm724x: Use min instead of ternary operator
authorBhumika Goyal <bhumirks@gmail.com>
Fri, 26 Feb 2016 10:04:32 +0000 (15:34 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Mar 2016 22:48:04 +0000 (14:48 -0800)
This patch replaces ternary operator with macro min as it shorter and
thus increases code readability. Macro min return the minimum of the
two compared values.
Made a semantic patch for changes:

@@
type T;
T x;
T y;
@@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gdm724x/gdm_mux.c

index 937010b3a6030d060291ebaca9659070c1e448d9..6bedd668324cff109be48556adf047a88ce58d68 100644 (file)
@@ -433,7 +433,7 @@ static int gdm_mux_send_control(void *priv_dev, int request, int value,
        if (ret < 0)
                pr_err("usb_control_msg error: %d\n", ret);
 
-       return ret < 0 ? ret : 0;
+       return min(ret, 0);
 }
 
 static void release_usb(struct mux_dev *mux_dev)