Skip to content

Commit 2a54c8c

Browse files
rmsilvajic23
authored andcommitted
iio: gyro: fxas21002c: balance runtime power in error path
If we fail to read temperature or axis we need to decrement the runtime pm reference count to trigger autosuspend. Add the call to pm_put to do that in case of error. Fixes: a0701b6 ("iio: gyro: add core driver for fxas21002c") Suggested-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Rui Miguel Silva <[email protected]> Link: https://lore.kernel.org/linux-iio/CBBZA9T1OY9C.2611WSV49DV2G@arch-thunder/ Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 04f5b9f commit 2a54c8c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iio/gyro/fxas21002c_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ static int fxas21002c_temp_get(struct fxas21002c_data *data, int *val)
399399
ret = regmap_field_read(data->regmap_fields[F_TEMP], &temp);
400400
if (ret < 0) {
401401
dev_err(dev, "failed to read temp: %d\n", ret);
402+
fxas21002c_pm_put(data);
402403
goto data_unlock;
403404
}
404405

@@ -432,6 +433,7 @@ static int fxas21002c_axis_get(struct fxas21002c_data *data,
432433
&axis_be, sizeof(axis_be));
433434
if (ret < 0) {
434435
dev_err(dev, "failed to read axis: %d: %d\n", index, ret);
436+
fxas21002c_pm_put(data);
435437
goto data_unlock;
436438
}
437439

0 commit comments

Comments
 (0)