1
0
Fork 0

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 <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
hifive-unleashed-5.1
Gargi Sharma 2017-03-07 23:50:27 +05:30 committed by Greg Kroah-Hartman
parent 9304b5b0d4
commit c95d2e87fc
1 changed files with 1 additions and 2 deletions

View File

@ -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,