On Wed, 16 Jun 2021 09:18:42 +0200 Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> wrote: > Em Sun, 16 May 2021 17:21:01 +0100 > Jonathan Cameron <jic23@xxxxxxxxxx> escreveu: > > > From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > > > > There is one path in which we don't do a runtime pm put and so > > leave the device enabled for ever more. > > > > Reported-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> > > Fixes: 4ac4e086fd8c ("iio: pulsedlight-lidar-lite: add runtime PM") > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > > Cc: Matt Ranostay <matt.ranostay@xxxxxxxxxxxx> > > I was unable to apply it on the top of next-20210615, although > the patch looks good to me. > > Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> Ah. This crossed with another fix for the same issue. I'll take another look at whether the alternate fix works as well as this and revisit this one at a future date. Thanks, Jonathan > > > --- > > drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c > > index 822a68ae5e03..ecaeb1e11007 100644 > > --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c > > +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c > > @@ -164,7 +164,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"); > > - return ret; > > + goto err; > > } > > > > while (tries--) { > > @@ -188,6 +188,7 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg) > > } > > ret = -EIO; > > } > > +err: > > pm_runtime_mark_last_busy(&client->dev); > > pm_runtime_put_autosuspend(&client->dev); > > > > > > Thanks, > Mauro