2015-11-08 06:57:59

by Ivan Safonov

[permalink] [raw]
Subject: [PATCH 01/12] staging: rtl8188eu: if/else replaced by min_t

Duplicated code removed.

Signed-off-by: Ivan Safonov <[email protected]>
---
drivers/staging/rtl8188eu/core/rtw_cmd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 433b926..69f8744d9 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -442,10 +442,8 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)

psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->IELength;

- if ((psecnetwork->IELength-12) < (256-1))
- memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], psecnetwork->IELength-12);
- else
- memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12], (256-1));
+ memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->IEs[12],
+ min_t(size_t, psecnetwork->IELength - 12, 256 - 1));

psecnetwork->IELength = 0;
/* Added by Albert 2009/02/18 */
--
2.4.10