From: William Hansen-Baird <william.hansen.baird@gmail.com>
To: gregkh@linuxfoundation.org
Cc: straube.linux@gmail.com, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org,
William Hansen-Baird <william.hansen.baird@gmail.com>
Subject: [PATCH v2] staging: rtl8723bs: replace ternary comparison with min_t()
Date: Sat, 31 Jan 2026 08:31:46 -0500 [thread overview]
Message-ID: <20260131133146.8174-1-william.hansen.baird@gmail.com> (raw)
Replace ternary comparison for setting copy_len with the min_t() function
from linux/minmax.h.
Change is purely cosmetic, however makes the line
easier to read without having to reason about logic.
---
v2:
Drop unrelated style changes and fix style issues by running checkpatch.
Keep min_t() to make the signedness of the comparison explicit.
(copy_len is an integer, wpa_ie_len is an integer but sizeof yields
size_t)
Signed-off-by: William Hansen-Baird <william.hansen.baird@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 8e41eb61448f..d36f6c3bc9b4 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -4,6 +4,7 @@
* Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
*
******************************************************************************/
+#include <linux/minmax.h>
#include <drv_types.h>
#include <rtw_wifi_regd.h>
#include <hal_btcoex.h>
@@ -1024,7 +1025,7 @@ static unsigned short rtw_parse_assoc_security_ies(struct adapter *padapter,
pstat->flags |= WLAN_STA_WPS;
copy_len = 0;
} else {
- copy_len = ((wpa_ie_len+2) > sizeof(pstat->wpa_ie)) ? (sizeof(pstat->wpa_ie)):(wpa_ie_len+2);
+ copy_len = min_t(int, sizeof(pstat->wpa_ie), wpa_ie_len + 2);
}
--
2.52.0
next reply other threads:[~2026-01-31 13:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-31 13:31 William Hansen-Baird [this message]
2026-01-31 14:43 ` Dan Carpenter
2026-01-31 15:55 ` David Laight
2026-01-31 17:35 ` Dan Carpenter
2026-01-31 21:43 ` William Hansen-Baird
2026-01-31 22:58 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260131133146.8174-1-william.hansen.baird@gmail.com \
--to=william.hansen.baird@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=straube.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome