Re: linux-4.4-rc8/drivers/gpio/gpio-generic.c: 2 * possible int/long mixup ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 4, 2016 at 10:12 AM, David Binderman <dcb314@xxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux