OSDN Git Service

iio: pressure: zpa2326: Remove always-true check which confuses gcc
authorGeert Uytterhoeven <geert@linux-m68k.org>
Wed, 5 Jul 2017 08:14:59 +0000 (10:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Nov 2018 15:42:54 +0000 (07:42 -0800)
commit1680ca362dad7f0ae4db4ab8b20629dc015a85ba
tree6c95d4ac34bb7d9e696e35877052f3dbb253f0eb
parentdfdf8be7dcc2fa84be2f6560e414f82d0176baa7
iio: pressure: zpa2326: Remove always-true check which confuses gcc

[ Upstream commit f61dfff2f5b9fcb087bf5c444bc44b444709588f ]

With gcc 4.1.2:

    drivers/iio/pressure/zpa2326.c: In function ‘zpa2326_wait_oneshot_completion’:
    drivers/iio/pressure/zpa2326.c:868: warning: ‘ret’ may be used uninitialized in this function

When testing for "timeout < 0", timeout is already guaranteed to be
strict negative, so the branch is always taken, and ret is thus always
initialized.  But (some version of) gcc is not smart enough to notice.

Remove the check to fix this.
As there is no other code in between assigning the error codes and
returning them, the error codes can be returned immediately, and the
intermediate variable can be dropped.
Drop the "else" to please checkpatch.

Fixes: e7215fe4d51e69c9 ("iio: pressure: zpa2326: report interrupted case as failure")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/pressure/zpa2326.c