From: David Laight <David.Laight@ACULAB.COM>
To: 'Julia Lawall' <julia.lawall@inria.fr>,
UMWARI JOVIAL <umwarijovial@gmail.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"outreachy@lists.linux.dev" <outreachy@lists.linux.dev>
Subject: RE: [PATCH] Remove Unnecessary typecast of c90 int constant
Date: Sat, 29 Oct 2022 11:15:27 +0000 [thread overview]
Message-ID: <aca0b365ab6b46789fd20dec14454ad6@AcuMS.aculab.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2210280918550.2845@hadrien>
From: Julia Lawall
> Sent: 28 October 2022 08:23
>
> On Fri, 28 Oct 2022, UMWARI JOVIAL wrote:
>
> > According to Linux kernel coding style.
> >
> > Reported by checkpatch:
> > WARNING: Unnecessary typecast of c90 int constant - '(int)2.412e8' could be '2.412e8'
> > WARNING: Unnecessary typecast of c90 int constant - '(int)2.487e8' could be '2.487e8'
>
> It's not ideal to just include the checkpatch messges verbatim in your log
> message. It woudl be better to say what you are doing and why, in
> complete sentences ("According to the Linux coding style" is not a
> complete sentence).
>
> I also suspect that the checkpatch message is wrong. Floating point
> numbers cannot be used in the kernel, and the case of the constant ensures
> that the value will be converted to an integer at compile time.
Much better to just use 241200000u (or 241200u * 1000 for readability).
David
>
> julia
>
> >
> > Signed-off-by: UMWARI JOVIAL <umwarijovial@gmail.com>
> > ---
> > drivers/staging/rtl8192e/rtllib_softmac_wx.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c
> b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
> > index fdf867a5dd7a..4fc4fb25d8d6 100644
> > --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c
> > +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
> > @@ -41,8 +41,8 @@ int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a,
> >
> > /* if setting by freq convert to channel */
> > if (fwrq->e == 1) {
> > - if ((fwrq->m >= (int)2.412e8 &&
> > - fwrq->m <= (int)2.487e8)) {
> > + if ((fwrq->m >= 2.412e8 &&
> > + fwrq->m <= 2.487e8)) {
> > int f = fwrq->m / 100000;
> > int c = 0;
> >
> > --
> > 2.25.1
> >
> >
> >
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2022-10-29 11:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 6:37 [PATCH] Remove Unnecessary typecast of c90 int constant UMWARI JOVIAL
2022-10-28 7:22 ` Julia Lawall
2022-10-28 7:42 ` jovial umwari
2022-10-29 11:15 ` David Laight [this message]
2022-10-29 14:38 ` Joe Perches
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=aca0b365ab6b46789fd20dec14454ad6@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=gregkh@linuxfoundation.org \
--cc=julia.lawall@inria.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=outreachy@lists.linux.dev \
--cc=umwarijovial@gmail.com \
/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