From: Gargi Sharma Date: Tue, 7 Mar 2017 18:20:27 +0000 (+0530) Subject: staging: gdm724x: Replace ternary operator with min macro X-Git-Tag: v4.12-rc1~84^2~656 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=c95d2e87fca1402e1a6a2a8577bf78abd401671f;p=linux.git staging: gdm724x: Replace ternary operator with min macro Use macro min() to get the minimum of two values for brevity and readability. The macro MUX_TX_MAX_SIZE has a value of 2048 which is well within the integer limits. This check was done manually. Found using Coccinelle: @@ type T; T x; T y; @@ ( - x < y ? x : y + min(x,y) | - x > y ? x : y + max(x,y) ) Signed-off-by: Gargi Sharma Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/gdm724x/gdm_tty.c b/drivers/staging/gdm724x/gdm_tty.c index ae396638f897..fc7682c18f20 100644 --- a/drivers/staging/gdm724x/gdm_tty.c +++ b/drivers/staging/gdm724x/gdm_tty.c @@ -190,8 +190,7 @@ static int gdm_tty_write(struct tty_struct *tty, const unsigned char *buf, return 0; while (1) { - sending_len = remain > MUX_TX_MAX_SIZE ? MUX_TX_MAX_SIZE : - remain; + sending_len = min(MUX_TX_MAX_SIZE, remain); gdm_tty_send(gdm, (void *)(buf + sent_len), sending_len,