OSDN Git Service

iio: proximity: pulsedlight: Fix rumtime PM imbalance on error
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Mon, 12 Apr 2021 05:32:02 +0000 (13:32 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 10 May 2021 13:01:48 +0000 (14:01 +0100)
When lidar_write_control() fails, a pairing PM usage counter
decrement is needed to keep the counter balanced.

Fixes: 4ac4e086fd8c5 ("iio: pulsedlight-lidar-lite: add runtime PM")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210412053204.4889-1-dinghao.liu@zju.edu.cn
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c

index c685f10..cc206bf 100644 (file)
@@ -160,6 +160,7 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
        ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);
        if (ret < 0) {
                dev_err(&client->dev, "cannot send start measurement command");
+               pm_runtime_put_noidle(&client->dev);
                return ret;
        }