From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Andy Whitcroft <apw@canonical.com>
Cc: me@tobin.cc, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, shiva@exdev.nl,
AndyS <lkd1024@mail.ru>,
gregkh@linuxfoundation.org
Subject: Re: [PATCH] Staging:ks7010:ks_wlan_net.c: unneeded type casting removed
Date: Mon, 10 Jul 2017 06:51:17 -0700 [thread overview]
Message-ID: <1499694677.5468.9.camel@perches.com> (raw)
In-Reply-To: <1499693983.5468.6.camel@perches.com>
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 <joe@perches.com>
---
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",
prev parent reply other threads:[~2017-07-10 13:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-10 7:09 [PATCH] Staging:ks7010:ks_wlan_net.c: unneeded type casting removed AndyS
2017-07-10 10:09 ` Frans Klaver
2017-07-10 10:31 ` kbuild test robot
2017-07-10 10:35 ` kbuild test robot
2017-07-10 13:39 ` Joe Perches
2017-07-10 13:51 ` Joe Perches [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1499694677.5468.9.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkd1024@mail.ru \
--cc=me@tobin.cc \
--cc=shiva@exdev.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox