diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-01-25 17:02:24 +0100 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2016-03-16 08:50:16 +0000 |
commit | a7e46317722ccdac6ae3bdb9476a1ec21b7aab6d (patch) | |
tree | 807ed6afee35d0a8d3a086316c5ee1f2301faf31 /lib/swiotlb.c | |
parent | b45b719ee03162eb54772c30a6474d57b41b6b54 (diff) | |
download | op-kernel-dev-a7e46317722ccdac6ae3bdb9476a1ec21b7aab6d.zip op-kernel-dev-a7e46317722ccdac6ae3bdb9476a1ec21b7aab6d.tar.gz |
mfd: db8500: Avoid uninitialized variable reference
The prcmu_config_clkout() function ensures that the 'clkout' argument
can only be '0' or '1' using an appropriate BUG_ON(), so the compiler
should know that the div_mask, mask, and bits variables are always
initialized later on. However, it doesn't understand this in gcc-5.2
and produces a false positive warning instead:
drivers/mfd/db8500-prcmu.c: In function 'prcmu_config_clkout':
drivers/mfd/db8500-prcmu.c:762:10: error: 'div_mask' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (val & div_mask) {
^
drivers/mfd/db8500-prcmu.c:769:13: error: 'mask' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if ((val & mask & ~div_mask) != bits) {
^
drivers/mfd/db8500-prcmu.c:757:7: error: 'bits' may be used uninitialized in this function [-Werror=maybe-uninitialized]
Replacing the switch() statement with an equivalent if() lets
gcc figure this out reliably and avoids the warnings.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'lib/swiotlb.c')
0 files changed, 0 insertions, 0 deletions