Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp34264imm; Thu, 7 Jun 2018 13:18:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKISnUd06sdgP6LdwtL7u4c1TKMUd3lv/8CRvHQQSKw1oySuBJREe6lpk5StcWsL7KL7u/Dd X-Received: by 2002:a62:d9c5:: with SMTP id b66-v6mr3090381pfl.41.1528402682494; Thu, 07 Jun 2018 13:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528402682; cv=none; d=google.com; s=arc-20160816; b=YvGf6e1ymWgz07Xkrcl3v24vW2+y00ma35MM8LnD+p4FEHwC/oGo61CgX1+y/OnZS6 YdfEvPb3eQP4pOkFHmZMCmsXd6NR71QafZDZUFNv++XHqsTdKFcEoeTSKh5bmTLdR/7y UGqDQ8ZzJbMrJGE4bzRvcQ42/EIbPcH0xTnb2mnzHq93Twg6Betj5AEyfqG6WO/b9yQ1 VZbS0BTuBPnityysx4nrac9SUkw3ZSDKMcKqd7jdDmOQkKqe7Zj70Lzed7spKAy/FRvi MHexY/P+z1U3r9700dunQGLdaxvHNd/HFT7WUkyY/T/ix9HOAuYIpDE/VUztEqYfo2Qq BcjA== 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=6pZOUtD7P5Miauml4efTxAQVoyYKJDM4zd3jzQm3O8E=; b=ZbX5HhLDtwNgC+HULYI1m778OQW4dxSa8/x9aKgTytpEp58/p21WAewtYW415XF/kK z3P66bw31fGjMU0EsbiP3IinNxJCo1MU9SohVsZyWIPdK5AIj92B7OAcPY8eHhhQ6d52 Ee7aB6S9jxPpUuMKweIE3eZhYeXiS0+7Xng01mSOVoTagTQEid6DFw5KAvOHaaru7wRV nPdx/yEiNPDKzTjiLcdY1xZn4U0c7iejpwlTM1W1OG06E3tp5rDbb0+KwYMMebWQEX+1 HCu59XH8UuhCK6kll0tjPn1Yn2g4MZlTdoSIospZmtxkhfPzm9LRMKpDLDCslHsdWOGt 8LUg== 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 u59-v6si54571966plb.253.2018.06.07.13.17.48; Thu, 07 Jun 2018 13:18:02 -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 S1753583AbeFGUQu (ORCPT + 99 others); Thu, 7 Jun 2018 16:16:50 -0400 Received: from smtprelay0142.hostedemail.com ([216.40.44.142]:43132 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750903AbeFGUQs (ORCPT ); Thu, 7 Jun 2018 16:16:48 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 00902837F24A; Thu, 7 Jun 2018 20:16:47 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3867:3870:3872:3874:4250:4321:5007:7903:10004:10400:10848:11232:11657:11658:11914:12296:12555:12740:12895:12986:13069:13311:13357:13439:13894:14096:14097:14659:14721:21080:21451:21627:30012:30054:30090:30091,0,RBL:47.151.150.235:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,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:30,LUA_SUMMARY:none X-HE-Tag: berry06_584755226b316 X-Filterd-Recvd-Size: 2087 Received: from XPS-9350.home (unknown [47.151.150.235]) (Authenticated sender: joe@perches.com) by omf11.hostedemail.com (Postfix) with ESMTPA; Thu, 7 Jun 2018 20:16:46 +0000 (UTC) Message-ID: <685aee141a45b09c46089a8bc777a037261ab447.camel@perches.com> Subject: Re: [PATCH] usb: Replace empty define with do while From: Joe Perches To: Corentin Labbe , gregkh@linuxfoundation.org, stern@rowland.harvard.edu Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Date: Thu, 07 Jun 2018 13:16:45 -0700 In-Reply-To: <1528401911-5263-1-git-send-email-clabbe@baylibre.com> References: <1528401911-5263-1-git-send-email-clabbe@baylibre.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-06-07 at 20:05 +0000, Corentin Labbe wrote: > It's dangerous to use empty code define. > Furthermore it lead to the following warning: > "suggest braces around empty body in an ? else ? statement" > > So let's replace emptyness by "do {} while(0)" I also suggest renaming COUNT to something more intelligible like INCR as the uses are all for incrementing variables that may not exist. > diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h > index c8e9a48e1d51..a60d91eac771 100644 > --- a/drivers/usb/host/ehci.h > +++ b/drivers/usb/host/ehci.h > @@ -237,7 +237,7 @@ struct ehci_hcd { /* one per controller */ > struct ehci_stats stats; > # define COUNT(x) ((x)++) > #else > -# define COUNT(x) > +# define COUNT(x) do {} while (0) > #endif > > /* debug files */ > diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h > index 7fcd785c7bc8..dca46d04e288 100644 > --- a/drivers/usb/host/fotg210.h > +++ b/drivers/usb/host/fotg210.h > @@ -179,7 +179,7 @@ struct fotg210_hcd { /* one per controller */ > struct fotg210_stats stats; > # define COUNT(x) ((x)++) > #else > -# define COUNT(x) > +# define COUNT(x) do {} while (0) > #endif > > /* debug files */