diff mbox series

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

Message ID 273b8f96-0d32-4913-bc6b-e91b391e7d7c@stanley.mountain (mailing list archive)
State Changes Requested
Headers show
Series iio: bmi323: Fix some bugs in suspend resume | expand

Commit Message

Dan Carpenter Sept. 11, 2024, 7:54 a.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>
---
 drivers/iio/imu/bmi323/bmi323_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Denis Benato Sept. 14, 2024, 12:10 p.m. UTC | #1
On 11/09/24 09:54, Dan Carpenter wrote:
> 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>
> ---
>  drivers/iio/imu/bmi323/bmi323_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/bmi323/bmi323_core.c b/drivers/iio/imu/bmi323/bmi323_core.c
> index d415b6542089..a56259c6434e 100644
> --- a/drivers/iio/imu/bmi323/bmi323_core.c
> +++ b/drivers/iio/imu/bmi323/bmi323_core.c
> @@ -2232,7 +2232,7 @@ 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)
>  		return ret;
>  
>  	/* Register must be cleared before changing an active config */
Hi,

Thanks for spotting this. May I ask to add an error message in that if case that will also print out the ret value?

Thank you very much!

Best regards,
Denis Benato
diff mbox series

Patch

diff --git a/drivers/iio/imu/bmi323/bmi323_core.c b/drivers/iio/imu/bmi323/bmi323_core.c
index d415b6542089..a56259c6434e 100644
--- a/drivers/iio/imu/bmi323/bmi323_core.c
+++ b/drivers/iio/imu/bmi323/bmi323_core.c
@@ -2232,7 +2232,7 @@  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)
 		return ret;
 
 	/* Register must be cleared before changing an active config */