lkml.org 
[lkml]   [2015]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v4 29/35] staging: rtl8192e: Replace ?: with max
Date
All get_key implementations return either -1 or small buffers, so
cast int->u16 is not a problem.

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
---
drivers/staging/rtl8192e/rtllib_wx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c
index 2ac1617..f31d864 100644
--- a/drivers/staging/rtl8192e/rtllib_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_wx.c
@@ -510,7 +510,8 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,
return 0;
}
len = crypt->ops->get_key(keybuf, SCM_KEY_LEN, NULL, crypt->priv);
- erq->length = (len >= 0 ? len : 0);
+
+ erq->length = max(len, 0);

erq->flags |= IW_ENCODE_ENABLED;

--
1.8.4.1


\
 
 \ /
  Last update: 2015-05-21 18:41    [W:0.216 / U:19.364 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site