[PATCH v2] staging: rtl8188eu: clamp kernel macro used in proc_get_rx_signal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To limit the range of integers there is clamp macro.

Signed-off-by: Ivan Safonov <insafonov@xxxxxxxxx>
---
Changes in v2:
  - big patchset splitted into some small independent patches.

 drivers/staging/rtl8188eu/core/rtw_debug.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_debug.c b/drivers/staging/rtl8188eu/core/rtw_debug.c
index 993c7db..2c4afb8 100644
--- a/drivers/staging/rtl8188eu/core/rtw_debug.c
+++ b/drivers/staging/rtl8188eu/core/rtw_debug.c
@@ -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;
-- 
2.4.10

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux