Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2142229imm; Thu, 21 Jun 2018 07:51:13 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJkS5D49cuRcqhwHAlAa4vj/fdhH28APv8Q82n2GwSoVQkSgVxaH/h9VY/ZCbAqmo9uVzJc X-Received: by 2002:a17:902:850b:: with SMTP id bj11-v6mr3607961plb.210.1529592672975; Thu, 21 Jun 2018 07:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529592672; cv=none; d=google.com; s=arc-20160816; b=ZEb2OOwozj4S4XFX0kb8szoBVJxVW3I9iQVpz7BfxHlfA5eBUu4OVPFYfB9DuHuXTC PCzFasgQAFFXyifF6iAGsJ52kTgtyWBZOrLKVqEMz9oCv2xBaDoCBIAv8E1yckP3YUxQ ca37TPltj3nFbYGEa1Vo8AMnMRNZ0L3yO/+UB+Etpa5/JExjeb08+rT8IffjjYaKfxZj FK9yE7uPVZSwxVS0An8lLYchtZkYC/EXinyEgcDRfYys5Y0QQMfBRDpNSKUrg3z/Z4FH n96qZwkJGKo9Qw6ZK+DFgW3yINvuWhaNFk0ThoZ3JBDjpe3MTf4Mkr5DxITyXSxWMUtp 0xmQ== 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=8siRYgzzYKQgBXzEU36kS57wB80dt5PvCoSMN8NofCM=; b=roEuAk+HIAgWMnnhCOX+fBgMYpymryuVziygm4fxLQGlgZIvNoMeucyXbhSYhTy/u5 Wi80XwakvT48FTAz4t2prB2sQGtq0K3KjOkZdXiWFYSPExbq8ZitB59GwyIz8j4ozCqP mV0YbQ7YQVHHnv25xEDvz46vUtqzd00267lF/rSjnPEN3usc68Eym4hA8MK79Nb3g9fd lhfBZPgqnEMdufo73pgOgiURZY6V+5yY6u5SnbyBmBhTBkTTbjRHYoQUDmRBtMFDKXUd XKmk9kkdlIj9Dv1bCjI6HN6NfVRDHuhPyAlE4z0JYJnU8RLbRtbKbIQXRZvVm9zpfaa5 3lCA== 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 z8-v6si4112496pgs.533.2018.06.21.07.50.57; Thu, 21 Jun 2018 07:51:12 -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 S933018AbeFUOsq (ORCPT + 99 others); Thu, 21 Jun 2018 10:48:46 -0400 Received: from smtprelay0231.hostedemail.com ([216.40.44.231]:55731 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932514AbeFUOsn (ORCPT ); Thu, 21 Jun 2018 10:48:43 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id CA489180F737D; Thu, 21 Jun 2018 14:48:42 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:967:973:988:989:1260:1263:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2525:2553:2560:2563:2682:2685:2828:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:6117:6120:6742:7557:7901:8599:8603:8700:8985:9025:9389:10004:10400:10848:11232:11658:11854:11914:12043:12219:12740:12760:12776:12895:13069:13161:13229:13311:13357:13439:14096:14097:14181:14651:14659:14721:21080:21433:21451:21627:30054:30070:30074:30090:30091,0,RBL:47.151.150.235:@perches.com:.lbl8.mailshell.net-62.14.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:25,LUA_SUMMARY:none X-HE-Tag: rule72_4baf34171461e X-Filterd-Recvd-Size: 2495 Received: from XPS-9350.home (unknown [47.151.150.235]) (Authenticated sender: joe@perches.com) by omf03.hostedemail.com (Postfix) with ESMTPA; Thu, 21 Jun 2018 14:48:39 +0000 (UTC) Message-ID: <8f9c37fd13abe2596521afb5d2779f644c214a93.camel@perches.com> Subject: Re: [PATCH v2 2/2] hwmon: npcm750: add NPCM7xx PWM and Fan driver From: Joe Perches To: Julia Lawall Cc: Guenter Roeck , Tomer Maimon , cocci , robh+dt@kernel.org, mark.rutland@arm.com, jdelvare@suse.com, avifishman70@gmail.com, yuenn@google.com, brendanhiggins@google.com, venture@google.com, joel@jms.id.au, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, openbmc@lists.ozlabs.org Date: Thu, 21 Jun 2018 07:48:38 -0700 In-Reply-To: References: <20180619105352.97181-1-tmaimon77@gmail.com> <20180619105352.97181-3-tmaimon77@gmail.com> <20180620164853.GA3459@roeck-us.net> 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 Thu, 2018-06-21 at 15:17 +0200, Julia Lawall wrote: > On Wed, 20 Jun 2018, Joe Perches wrote: > > Also, spatch (1.0.4) seems to have a defect for this > > when the type is used in operations that change a > > smaller type to int or unsigned int. > > > > i.e.: (offset is u16, but offset * 2 is int) > > Ah. The rule is that the result type is always the larger one? Yes, but not quite, no. The c90 rules are called "integer promotions" and are detailed in section 6.3 Conversions Basically, if any type is smaller than int, all operations are done as int if possible, or unsigned int if necessary. If any type is larger than int, then the larger type is used. If you don't have the c90 standard, this one is close enough. http://c0x.coding-guidelines.com/6.3.html (use the next button several times to read the whole section) Also, section 6.5 details "expressions" where the operands of things like bit operations use integer promotions. > Unfortunately, Coccinelle doesn't know the size of any type. I could add > some special cases, but that may be more confusing than helpful. Maybe, but when I saw the suggested removal, I was surprised.