diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-08-22 16:16:42 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-08-26 19:11:10 +0200 |
commit | 95c520690f5fafb2cda2ec17f8c76ab3422b0174 (patch) | |
tree | 0dec0f5683f21100b61b19a141512ebe0bac3aea /drivers/media/pci/solo6x10/solo6x10-gpio.c | |
parent | media: use the BIT() macro (diff) | |
download | linux-95c520690f5fafb2cda2ec17f8c76ab3422b0174.tar.xz linux-95c520690f5fafb2cda2ec17f8c76ab3422b0174.zip |
media: don't do a 31 bit shift on a signed int
On 32-bits archs, a signed integer has 31 bits plus on extra
bit for signal. Due to that, touching the 32th bit with something
like:
int bar = 1 << 31;
has an undefined behavior in C on 32 bit architectures, as it
touches the signal bit. This is warned by cppcheck.
Instead, force the numbers to be unsigned, in order to solve this
issue.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/pci/solo6x10/solo6x10-gpio.c')
-rw-r--r-- | drivers/media/pci/solo6x10/solo6x10-gpio.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/pci/solo6x10/solo6x10-gpio.c b/drivers/media/pci/solo6x10/solo6x10-gpio.c index 5caeca8b5dd0..526d67cf9942 100644 --- a/drivers/media/pci/solo6x10/solo6x10-gpio.c +++ b/drivers/media/pci/solo6x10/solo6x10-gpio.c @@ -39,13 +39,13 @@ static void solo_gpio_mode(struct solo_dev *solo_dev, ret = solo_reg_read(solo_dev, SOLO_GPIO_CONFIG_1); for (port = 0; port < 16; port++) { - if (!((1 << (port + 16)) & port_mask)) + if (!((1UL << (port + 16)) & port_mask)) continue; if (!mode) - ret &= ~(1 << port); + ret &= ~(1UL << port); else - ret |= 1 << port; + ret |= 1UL << port; } /* Enable GPIO[31:16] */ |