[PATCH 9/9] iio: magnetometer: ak8974: remove conditional return with no effect
From: Sang-Heon Jeon
Date: Mon Jul 27 2026 - 14:50:55 EST
Both branches of the check return the same value, so the check has no
effect. Remove it and return the value directly.
This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.
Signed-off-by: Sang-Heon Jeon <ekffu200098@xxxxxxxxx>
Reviewed-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
---
drivers/iio/magnetometer/ak8974.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
index c7fdb7c2f543..c988d0e40cea 100644
--- a/drivers/iio/magnetometer/ak8974.c
+++ b/drivers/iio/magnetometer/ak8974.c
@@ -379,11 +379,7 @@ static int ak8974_getresult(struct ak8974 *ak8974, __le16 *result)
return -ERANGE;
}
- ret = regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
- if (ret)
- return ret;
-
- return ret;
+ return regmap_bulk_read(ak8974->map, AK8974_DATA_X, result, 6);
}
static irqreturn_t ak8974_drdy_irq(int irq, void *d)
--
2.43.0