aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2017-07-05 04:14:59 -0400
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2017-09-25 16:39:00 -0400
commitf61dfff2f5b9fcb087bf5c444bc44b444709588f (patch)
treede2e73a6855f1805e60467b66fa613895a3e9a29
parenteb35279dd7c7834d6320edf24e1b9786d31e4899 (diff)
iio: pressure: zpa2326: Remove always-true check which confuses gcc
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>
-rw-r--r--drivers/iio/pressure/zpa2326.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c
index ebfb1de7377f..91431454eb85 100644
--- a/drivers/iio/pressure/zpa2326.c
+++ b/drivers/iio/pressure/zpa2326.c
@@ -865,7 +865,6 @@ complete:
865static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev, 865static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev,
866 struct zpa2326_private *private) 866 struct zpa2326_private *private)
867{ 867{
868 int ret;
869 unsigned int val; 868 unsigned int val;
870 long timeout; 869 long timeout;
871 870
@@ -887,14 +886,11 @@ static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev,
887 /* Timed out. */ 886 /* Timed out. */
888 zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)", 887 zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)",
889 timeout); 888 timeout);
890 ret = -ETIME; 889 return -ETIME;
891 } else if (timeout < 0) {
892 zpa2326_warn(indio_dev,
893 "wait for one shot interrupt cancelled");
894 ret = -ERESTARTSYS;
895 } 890 }
896 891
897 return ret; 892 zpa2326_warn(indio_dev, "wait for one shot interrupt cancelled");
893 return -ERESTARTSYS;
898} 894}
899 895
900static int zpa2326_init_managed_irq(struct device *parent, 896static int zpa2326_init_managed_irq(struct device *parent,