From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932255AbdGJNvX (ORCPT ); Mon, 10 Jul 2017 09:51:23 -0400 Received: from smtprelay0128.hostedemail.com ([216.40.44.128]:47722 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932079AbdGJNvV (ORCPT ); Mon, 10 Jul 2017 09:51:21 -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:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1714:1730:1747:1777:1792:2197:2198:2199:2200:2393:2559:2562:2828:3138:3139:3140:3141:3142:3351:3653:3866:3867:3872:3874:4321:5007:10004:10400:10848:11026:11473:11658:11783:11914:12043:12438:12555:13069:13311:13357:13439:13894:14181:14659:14721:21080:21221:21627:30054:30070,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: curve96_62d92b1508743 X-Filterd-Recvd-Size: 1834 Message-ID: <1499694677.5468.9.camel@perches.com> Subject: Re: [PATCH] Staging:ks7010:ks_wlan_net.c: unneeded type casting removed From: Joe Perches To: Andrew Morton , Andy Whitcroft Cc: me@tobin.cc, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, shiva@exdev.nl, AndyS , gregkh@linuxfoundation.org Date: Mon, 10 Jul 2017 06:51:17 -0700 In-Reply-To: <1499693983.5468.6.camel@perches.com> References: <20170710070950.1693-1-lkd1024@mail.ru> <1499693983.5468.6.camel@perches.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 A floating point constant cast to an int was giving a false positive warning about unneeded cast to int. e.g.: (fwrq->m >= (int)2.412e8) && (fwrq->m <= (int)2.487e8)) Fix it. Though it's probably better to avoid float/double values that are cast to int at all. Signed-off-by: Joe Perches ---  scripts/checkpatch.pl | 3 ++-  1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2287a0bca863..cbd99c22e2f6 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5673,7 +5673,8 @@ sub process {   }    # check for cast of C90 native int or longer types constants - if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/) { + if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/ && +     $2 !~ /^$Float$/) {   my $cast = $1;   my $const = $2;   if (WARN("TYPECAST_INT_CONSTANT",