staging: rtl8188eu: clamp kernel macro used in proc_get_rx_signal
authorIvan Safonov <insafonov@gmail.com>
Tue, 27 Oct 2015 15:15:31 +0000 (22:15 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2015 00:09:08 +0000 (09:09 +0900)
To limit the range of integers there is clamp macro.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_debug.c

index 993c7db87a1a5b83e79bdd8bc6e23f414a894c05..2c4afb80fc6440bdab25c4196d2b4cb3aed02eb9 100644 (file)
@@ -594,8 +594,7 @@ int proc_set_rx_signal(struct file *file, const char __user *buffer,
                if (is_signal_dbg && num != 2)
                        return count;
 
-               signal_strength = signal_strength > 100 ? 100 : signal_strength;
-               signal_strength = signal_strength < 0 ? 0 : signal_strength;
+               signal_strength = clamp(signal_strength, 0, 100);
 
                padapter->recvpriv.is_signal_dbg = is_signal_dbg;
                padapter->recvpriv.signal_strength_dbg = signal_strength;