summaryrefslogtreecommitdiffstats
path: root/drivers/iio/magnetometer
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2017-01-11 18:49:33 +0100
committerJonathan Cameron <jic23@kernel.org>2017-01-14 14:10:04 +0100
commite2eb179c0031b8cd172d8a7869451ff57184388b (patch)
tree0fbbc6ac24d0f8d424b125fd60b5bbaa4a303e33 /drivers/iio/magnetometer
parentiio: Documentation: Add proximity unit (diff)
downloadlinux-e2eb179c0031b8cd172d8a7869451ff57184388b.tar.xz
linux-e2eb179c0031b8cd172d8a7869451ff57184388b.zip
iio: magnetometer: ak8974: remove redundant zero timeout check
At the end of the delay loop timeout will always be zero and hence the check for !timeout will always be true. Remove the redundant check and the redundant return 0 at the end of the function. Fixes CoverityScan CID#1357168 ("Logically dead code") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/magnetometer')
-rw-r--r--drivers/iio/magnetometer/ak8974.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
index ce09d771c1fb..6dd8cbd7ce95 100644
--- a/drivers/iio/magnetometer/ak8974.c
+++ b/drivers/iio/magnetometer/ak8974.c
@@ -278,13 +278,9 @@ static int ak8974_await_drdy(struct ak8974 *ak8974)
if (val & AK8974_STATUS_DRDY)
return 0;
} while (--timeout);
- if (!timeout) {
- dev_err(&ak8974->i2c->dev,
- "timeout waiting for DRDY\n");
- return -ETIMEDOUT;
- }
- return 0;
+ dev_err(&ak8974->i2c->dev, "timeout waiting for DRDY\n");
+ return -ETIMEDOUT;
}
static int ak8974_getresult(struct ak8974 *ak8974, __le16 *result)