From: Linus Walleij <linus.walleij@linaro.org>
To: David Binderman <dcb314@hotmail.com>
Cc: "gnurou@gmail.com" <gnurou@gmail.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: linux-4.4-rc8/drivers/gpio/gpio-generic.c: 2 * possible int/long mixup ?
Date: Tue, 5 Jan 2016 10:43:21 +0100 [thread overview]
Message-ID: <CACRpkda5H3A37XXwgV4aWTObWhxrkP8PgTud3B_Yssm91wg=7A@mail.gmail.com> (raw)
In-Reply-To: <DUB128-W5686644DDCB66C9E75ECBB9CF20@phx.gbl>
On Mon, Jan 4, 2016 at 10:12 AM, David Binderman <dcb314@hotmail.com> wrote:
> [linux-4.4-rc8/drivers/gpio/gpio-generic.c:129]: (style) int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information.
Where does this come from? Sparse? Coverity? Polyspace?
> Source code is
>
> static unsigned long bgpio_pin2mask(struct bgpio_chip *bgc, unsigned int pin)
> {
> return 1 << pin;
> }
>
> I don't know if pin can be>= 32. Suggest new code
>
> static unsigned long bgpio_pin2mask(struct bgpio_chip *bgc, unsigned int pin)
> {
> return 1UL << pin;
> }
I suggest:
#include <linux/bitops.h>
return BIT(pin);
Do you wanna patch it? Or should I do it?
Yours,
Linus Walleij
parent reply other threads:[~2016-01-05 9:43 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <DUB128-W5686644DDCB66C9E75ECBB9CF20@phx.gbl>]
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='CACRpkda5H3A37XXwgV4aWTObWhxrkP8PgTud3B_Yssm91wg=7A@mail.gmail.com' \
--to=linus.walleij@linaro.org \
--cc=dcb314@hotmail.com \
--cc=gnurou@gmail.com \
--cc=linux-gpio@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;
as well as URLs for NNTP newsgroup(s).