From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751872AbdKHRar (ORCPT ); Wed, 8 Nov 2017 12:30:47 -0500 Received: from smtprelay0109.hostedemail.com ([216.40.44.109]:42525 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751954AbdKHRaq (ORCPT ); Wed, 8 Nov 2017 12:30:46 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2828:2917:3138:3139:3140:3141:3142:3165:3355:3622:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:5007:7514:7903:8531:8957:10004:10400:10848:11026:11232:11657:11658:11914:12043:12048:12438:12555:12700:12737:12740:12760:12895:13160:13229:13439:14093:14096:14097:14181:14659:14721:21080:21324:21326:21365:21433:21451:21611:21627:30012:30022:30051:30054:30064:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: beef06_235ba2c2f9648 X-Filterd-Recvd-Size: 3749 Message-ID: <1510162241.15768.26.camel@perches.com> Subject: Re: [PATCH] staging: fsl-dpaa2: Fix multiple assignments should be avoided From: Joe Perches To: Randy Dunlap , Dan Carpenter , Greg KH , Andy Whitcroft Cc: Joshua Abraham , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Linus Torvalds Date: Wed, 08 Nov 2017 09:30:41 -0800 In-Reply-To: References: <20171108004503.GA27756@josharch> <20171108092048.GB22620@kroah.com> <20171108094033.d2swiivinynlatlm@mwanda> <1510141182.15768.17.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2017-11-08 at 09:16 -0800, Randy Dunlap wrote: > On 11/08/2017 03:39 AM, Joe Perches wrote: > > On Wed, 2017-11-08 at 12:40 +0300, Dan Carpenter wrote: > > > On Wed, Nov 08, 2017 at 10:20:48AM +0100, Greg KH wrote: > > > > On Tue, Nov 07, 2017 at 07:45:03PM -0500, Joshua Abraham wrote: > > > > > This patch fixes the checkpatch.pl warning: > > > > > "CHECK: multiple assignments should be avoided" [] > > > > > diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c [] > > > > > @@ -1661,7 +1661,8 @@ static void set_fq_affinity(struct dpaa2_eth_priv *priv) > > > > > * This may well change at runtime, either through irqbalance or > > > > > * through direct user intervention. > > > > > */ > > > > > - rx_cpu = txc_cpu = cpumask_first(&priv->dpio_cpumask); > > > > > + rx_cpu = cpumask_first(&priv->dpio_cpumask); > > > > > + txc_cpu = rx_cpu; > > > > > > > > The original code here makes much more sense, doesn't it? > > > > > > > > Sometimes checkpatch is wrong :) > > > > > > It feels like the majority of these multiple assignment warnings are > > > wrong. I thought it would be a good idea at first but after looking at > > > a bunch of the patches it feels like we should just remove the check. > > > > I don't have a particular opinion one way or another. > > > > That bit was added to CodingStyle by Randy Dunlap back > > in 2006 by > > > > commit b3fc9941fbc6efe5cb77728adb0fb12be363e73e > > Author: Randy Dunlap > > Date: Sun Dec 10 02:18:56 2006 -0800 > > > > [PATCH] CodingStyle updates > > > > Add some kernel coding style comments, mostly pulled from emails > > by Andrew Morton, Jesper Juhl, and Randy Dunlap. [] > > - add paragraph on multiple-assignments [] > > Signed-off-by: Randy Dunlap > > Acked-by: Jesper Juhl > > Acked-by: Jan Engelhardt > > Signed-off-by: Andrew Morton > > So it was. I would certainly support removing it. > > I suspect I copied that from someone else's email. My personal style > would be to allow that. My personal style too actually. foo = bar = baz(); is rather more sensible to me than bar = baz(); foo = bar; I think this style stems from the desire to be similar to single line definitions, but if the identifier lengths are short it really doesn't make the code better to read. Though I personally do prefer int i; int *j; over int i, *j;