Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751739AbdFVQH7 (ORCPT ); Thu, 22 Jun 2017 12:07:59 -0400 Received: from smtprelay0003.hostedemail.com ([216.40.44.3]:46458 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751094AbdFVQH6 (ORCPT ); Thu, 22 Jun 2017 12:07:58 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2731:2828:3138:3139:3140:3141:3142:3173:3352:3622:3865:3868:3870:4321:4605:5007:6742:7576:7875:7903:10004:10400:10848:11026:11232:11657:11658:11914:12043:12438:12740:12895:13069:13311:13357:13439:13894:14181:14659:14721:21080:21451:21627:30054:30080: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:4,LUA_SUMMARY:none X-HE-Tag: oil08_62334dc60a32b X-Filterd-Recvd-Size: 2217 Message-ID: <1498147673.24295.6.camel@perches.com> Subject: Re: [PATCH 01/14] staging: fsl-mc: drop macros with possible side effects From: Joe Perches To: laurentiu.tudor@nxp.com, gregkh@linuxfoundation.org, stuyoder@gmail.com Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, marc.zyngier@arm.com, agraf@suse.de, arnd@arndb.de, ioana.ciornei@nxp.com, ruxandra.radulescu@nxp.com, bharat.bhushan@nxp.com, catalin.horghidan@nxp.com, leoyang.li@nxp.com, roy.pledge@nxp.com, linux-arm-kernel@lists.infradead.org Date: Thu, 22 Jun 2017 09:07:53 -0700 In-Reply-To: <20170622133600.31694-2-laurentiu.tudor@nxp.com> References: <20170622133600.31694-1-laurentiu.tudor@nxp.com> <20170622133600.31694-2-laurentiu.tudor@nxp.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1085 Lines: 34 On Thu, 2017-06-22 at 16:35 +0300, laurentiu.tudor@nxp.com wrote: > From: Laurentiu Tudor > > Several macros were triggering this checkpatch.pl warning: > "Macro argument reuse '$arg' - possible side-effects?" > Fix the warning by turning them into real functions. good idea and > diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c [] > +static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev, > + struct dprc_obj_desc *obj_desc) > +{ > + return !strcmp(mc_dev->obj_desc.type, obj_desc->type) && > + mc_dev->obj_desc.id == obj_desc->id; > +} I'd reverse the test order and do the strcmp after the comparison return?mc_dev->obj_desc.id == obj_desc->id && !strcmp(mc_dev->obj_desc.type, obj_desc->type); [] > +static bool __must_check fsl_mc_is_allocatable(const char *obj_type) > +{ > + return strcmp(obj_type, "dpbp") == 0 || > + strcmp(obj_type, "dpmcp") == 0 || > + strcmp(obj_type, "dpcon") == 0; > +} please be consistent in using either == 0 or ! when using strcmp