Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966284AbbKFVmx (ORCPT ); Fri, 6 Nov 2015 16:42:53 -0500 Received: from mail-yk0-f173.google.com ([209.85.160.173]:33956 "EHLO mail-yk0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965979AbbKFVmv convert rfc822-to-8bit (ORCPT ); Fri, 6 Nov 2015 16:42:51 -0500 MIME-Version: 1.0 In-Reply-To: <20151106151846.GA12146@alpha.sfu-kras.ru> References: <20151106151846.GA12146@alpha.sfu-kras.ru> Date: Fri, 6 Nov 2015 23:42:50 +0200 Message-ID: Subject: Re: [PATCH 2/3] staging: rtl8188eu: if/else replaced by min_t From: Andy Shevchenko To: Ivan Safonov Cc: devel@driverdev.osuosl.org, Greg Kroah-Hartman , Larry Finger , Vaishali Thakkar , Bryan Paul , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1777 Lines: 48 On Fri, Nov 6, 2015 at 5:18 PM, Ivan Safonov wrote: > Duplicated code removed. > > Signed-off-by: Ivan Safonov > --- > drivers/staging/rtl8188eu/core/rtw_cmd.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c > index c0fff77..80c602e 100644 > --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c > +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c > @@ -446,10 +446,7 @@ 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(int, psecnetwork->IELength - 12, 256 - 1)); > Run checkpatch.pl. 256 looks like sizeof(…). > 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/ -- With Best Regards, Andy Shevchenko -- 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/