]> git.baikalelectronics.ru Git - kernel.git/commit
spi/rockchip: avoid uninitialized-use warning
authorArnd Bergmann <arnd@arndb.de>
Wed, 28 Jan 2015 13:25:10 +0000 (14:25 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 28 Jan 2015 17:36:37 +0000 (17:36 +0000)
commit217acb6d0c62618bf5fba345b14f2d8fe4a0c123
tree1e85e3fc8d79fa854451f4825be029ff71f434fe
parentbfa6fa2a2dfa997f6c80e35808e50464ecfebcda
spi/rockchip: avoid uninitialized-use warning

We currently get a warning about potentially uninitialized variables
in the rockchip spi driver, at least in certain toolchain versions:

spi/spi-rockchip.c: In function 'rockchip_spi_prepare_dma':
include/linux/dmaengine.h:796:2: warning: 'txdesc' may be used uninitialized in this function
include/linux/dmaengine.h:796:2: warning: 'rxdesc' may be used uninitialized in this function

The reason seems to be that gcc cannot know whether the value
of the rs->rx and rs->tx variables change between the two points
these are accessed.

The code is actually correct, but to make this clearer to the
compiler, this changes the conditionals to test for the local
rxdesc/txdesc variables instead, which it knows won't change.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-rockchip.c