diff mbox series

[v2,2/2] iio: bmi323: fix reversed if statement in bmi323_core_runtime_resume()

Message ID 689a2122-6e2f-4b0c-9a1c-39a98621c6c1@stanley.mountain (mailing list archive)
State Accepted
Headers show
Series iio: bmi323: Fix some bugs in suspend resume | expand

Commit Message

Dan Carpenter Sept. 16, 2024, 2:09 p.m. UTC
This reversed if statement means that the function just returns success
without writing to the registers.

Fixes: 16531118ba63 ("iio: bmi323: peripheral in lowest power state on suspend")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: Added the dev_err() message

 drivers/iio/imu/bmi323/bmi323_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/iio/imu/bmi323/bmi323_core.c b/drivers/iio/imu/bmi323/bmi323_core.c
index f6ff07ba98cd..527d6c321ab3 100644
--- a/drivers/iio/imu/bmi323/bmi323_core.c
+++ b/drivers/iio/imu/bmi323/bmi323_core.c
@@ -2226,8 +2226,10 @@  static int bmi323_core_runtime_resume(struct device *dev)
 	 * after being reset in the lower power state by runtime-pm.
 	 */
 	ret = bmi323_init(data);
-	if (!ret)
+	if (ret) {
+		dev_err(data->dev, "Device power-on and init failed: %d", ret);
 		return ret;
+	}
 
 	/* Register must be cleared before changing an active config */
 	ret = regmap_write(data->regmap, BMI323_FEAT_IO0_REG, 0);