Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2356988imm; Sat, 16 Jun 2018 16:15:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIK+lGYjdX9TuPb8ZBnbWsaNZUR4gCetWLpliArRcE6L4FL9+7ai12PTMiqCa+ORCGklAtg X-Received: by 2002:a63:384c:: with SMTP id h12-v6mr6318784pgn.230.1529190910637; Sat, 16 Jun 2018 16:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529190910; cv=none; d=google.com; s=arc-20160816; b=FQc5mMwiypsc6SZj+irdhzzjiQEqGO2a10m9YWLnRXKQHLO3F6vIu/5MjCkS47hTqq kqvihheVi9z3UN+BZtjjPu9+X7XaTeiIAgyp3C5T0S3o8flUDUbT0BzeFFL1kbwljvgd Uxj8gkKEeiezutmiVrFKkARj66CBv72pcYFCGvDhv+v9zJT8NmCGB23dUPN+YbJXSULw u6bbNeaaTZny23thGmj8HR8Oqajf3tmr1Z4wwuu+BR2t8luY6WkakjzZjX/3GvOwyeY7 OnVXV8lYBruGNsybFACM/iHTiGJby5lJCmDuqz2dP+H171IScoqIuelERpJUw5q4CJds 4PZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=fw7WB4Ql1Jb5IOpqsQn9gUuDbICeJ7k2G/8M0tMcUKw=; b=cW5Ax6anBGAd9fvNr+EMulG3YXMlmUoJg+P/3cwJCywGq8+ndOnuoDo4IkZsoCJlO7 qwM0Uq7+5hVQFy49gljP0phHKoR+00W+5sicUKAOXlSoKD9I9I0QMLU0HzxlK2TYdLpN NN3bxK2sQL3ybHGO9zEGphby4DHv8fJZ//GoMNel6/v4heeGI4aO8yGkv/ytBws0QAjG 5XqT+8OUnOK3EK43jikPkE882tNqpveQV6FZcTK9EFSTDAjnRn0WHLiVCeXDOIfXVtkr KXbgi2HQYylQ0w/qQm/03ZhQfrhDKOVJQbwjwrVawNzf/v//K/qZ6Z+YhpYt3PfGjiRf 3D1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11-v6si9114680pgp.95.2018.06.16.16.14.43; Sat, 16 Jun 2018 16:15:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756890AbeFPXOF (ORCPT + 99 others); Sat, 16 Jun 2018 19:14:05 -0400 Received: from smtprelay0158.hostedemail.com ([216.40.44.158]:40517 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754164AbeFPXOE (ORCPT ); Sat, 16 Jun 2018 19:14:04 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id 1595018028201; Sat, 16 Jun 2018 23:14:03 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::,RULES_HIT:41:69:355:379:541:599:800:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:4321:4605:5007:7904:8957:10004:10400:10848:10967:11026:11232:11658:11914:12043:12296:12438:12555:12740:12760:12895:13439:14181:14659:14721:21080:21627:30029:30054:30090:30091,0,RBL:error,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: fork01_7a6c7c0398a01 X-Filterd-Recvd-Size: 3394 Received: from XPS-9350.home (unknown [47.151.150.235]) (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Sat, 16 Jun 2018 23:14:01 +0000 (UTC) Message-ID: <5ad0ea84d5b8733e7bb7a647e185f2577c073cf5.camel@perches.com> Subject: Re: [PATCH] staging: rtl8192u: fix line over 80 characters From: Joe Perches To: valdis.kletnieks@vt.edu, Hyunil Kim Cc: gregkh@linuxfoundation.org, davem@davemloft.net, colin.king@canonical.com, johannes.berg@intel.com, Linyu.Yuan@alcatel-sbell.com.cn, keescook@chromium.org, tvboxspy@gmail.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Date: Sat, 16 Jun 2018 16:13:59 -0700 In-Reply-To: <127735.1529176927@turing-police.cc.vt.edu> References: <1909265.MoDodiKBI3@os-virtualbox> <127735.1529176927@turing-police.cc.vt.edu> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2018-06-16 at 15:22 -0400, valdis.kletnieks@vt.edu wrote: > On Sat, 16 Jun 2018 15:00:31 +0900, Hyunil Kim said: > > *fix checkpatch.pl warnings: > > WARNING: line over 80 characters > > + if (((ieee->wpa_ie[0] == 0xdd) && > > + (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) || > > + ((ieee->wpa_ie[0] == 0x30) && > > + (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4)))) > > Ouch. The && and || at ends of line mean a lot of parenthesis counting to > figure out which goes with which. Use additional indentation to help > understanding. > > + if (((ieee->wpa_ie[0] == 0xdd) && > + (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) || > + ((ieee->wpa_ie[0] == 0x30) && > + (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4)))) > > Or perhaps > > + if (((ieee->wpa_ie[0] == 0xdd) && > + (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) > + || ((ieee->wpa_ie[0] == 0x30) && > + (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4)))) Or perhaps refactor to something like: --- drivers/staging/rtl8192u/r8192U_core.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 8b17400f6c13..593ecc0ae1ae 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2039,20 +2039,18 @@ static bool GetNmodeSupportBySecCfg8192(struct net_device *dev) (strcmp(crypt->ops->name, "WEP") == 0)); /* simply judge */ - if (encrypt && (wpa_ie_len == 0)) { - /* wep encryption, no N mode setting */ + /* wep encryption, no N mode setting */ + if (encrypt && wpa_ie_len == 0) return false; - } else if ((wpa_ie_len != 0)) { - /* parse pairwise key type */ - if (((ieee->wpa_ie[0] == 0xdd) && (!memcmp(&(ieee->wpa_ie[14]), ccmp_ie, 4))) || ((ieee->wpa_ie[0] == 0x30) && (!memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4)))) - return true; - else - return false; - } else { + + if (wpa_ie_len == 0) return true; - } - return true; + /* parse pairwise key type */ + return (ieee->wpa_ie[0] == 0xdd && + !memcmp(&ieee->wpa_ie[14], ccmp_ie, 4)) || + (ieee->wpa_ie[0] == 0x30 && + !memcmp(&ieee->wpa_ie[10], ccmp_rsn_ie, 4)); } static bool GetHalfNmodeSupportByAPs819xUsb(struct net_device *dev)