From 622fd4942dc301cb9fcd38243c92218cfa5bd7f5 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Sun, 31 May 2015 20:19:47 +0200 Subject: [PATCH] staging: rtl8192e: Replace ?: with max All get_key implementations return either -1 or small buffers, so cast int->u16 is not a problem. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- 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 2ac161786796..f31d864df6cc 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; -- 2.39.5