From: Chris Cesare <chris.cesare@gmail.com>
To: abbotti@mev.co.uk
Cc: hsweeten@visionengravers.com, gregkh@linuxfoundation.org,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Chris Cesare <chris.cesare@gmail.com>
Subject: [PATCH v2 2/2] staging: comedi: serial2002: Fix unnecessary cast styling issue
Date: Thu, 9 Jun 2016 15:39:03 -0400 [thread overview]
Message-ID: <1465501143-10445-3-git-send-email-chris.cesare@gmail.com> (raw)
In-Reply-To: <1465501143-10445-1-git-send-email-chris.cesare@gmail.com>
checkpatch.pl warns that a cast of 1 to (long long) is unnecessary.
Remove the cast and also add code to check and make sure that
maxdata_list[chan] is not shifted too far, as suggested by Ian
Abbott.
Signed-off-by Chris Cesare <chris.cesare@gmail.com>
---
drivers/staging/comedi/drivers/serial2002.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c
index b777946..0d33e52 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -379,7 +379,10 @@ static int serial2002_setup_subdevice(struct comedi_subdevice *s,
range_table_list[chan] =
(const struct comedi_lrange *)&range[j];
}
- maxdata_list[chan] = ((long long)1 << cfg[j].bits) - 1;
+ if (cfg[j].bits < 32)
+ maxdata_list[chan] = (1u << cfg[j].bits) - 1;
+ else
+ maxdata_list[chan] = 0xffffffff;
chan++;
}
}
--
2.7.4
next prev parent reply other threads:[~2016-06-09 19:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <57593890.2060800@mev.co.uk>
2016-06-09 19:39 ` [PATCH v2 0/2] staging: comedi: serial2002: Fix two styling issues Chris Cesare
2016-06-09 19:39 ` [PATCH v2 1/2] staging: comedi: serial2002: Fix bare unsigned styling issue Chris Cesare
2016-06-09 19:39 ` Chris Cesare [this message]
2016-06-10 10:40 ` [PATCH v2 0/2] staging: comedi: serial2002: Fix two styling issues Ian Abbott
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=1465501143-10445-3-git-send-email-chris.cesare@gmail.com \
--to=chris.cesare@gmail.com \
--cc=abbotti@mev.co.uk \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
/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