Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754820AbbKHG6o (ORCPT ); Sun, 8 Nov 2015 01:58:44 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:36239 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753624AbbKHG6i (ORCPT ); Sun, 8 Nov 2015 01:58:38 -0500 Date: Sun, 8 Nov 2015 11:29:52 +0700 From: Ivan Safonov To: devel@driverdev.osuosl.org Cc: Greg Kroah-Hartman , Vaishali Thakkar , Jakub Sitnicki , Anish Bhatt , Joe Perches , Ivan Safonov , Nicholas Mc Guire , Alexey Khoroshilov , =?iso-8859-1?Q?R=E9my?= Oudompheng , Sudip Mukherjee , Shraddha Barke , linux-kernel@vger.kernel.org Subject: [PATCH 01/13] staging: rtl8188eu: if/else replaced by min_t Message-ID: <20151108042951.GA27831@alpha.sfu-kras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1268 Lines: 32 Duplicated code removed. Signed-off-by: Ivan Safonov --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/