diff mbox series

[v2] iio: proximity: pulsedlight: Fix rumtime PM imbalance on error

Message ID 20210412053204.4889-1-dinghao.liu@zju.edu.cn (mailing list archive)
State New, archived
Headers show
Series [v2] iio: proximity: pulsedlight: Fix rumtime PM imbalance on error | expand

Commit Message

Dinghao Liu April 12, 2021, 5:32 a.m. UTC
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>
---

Changelog:

v2: - Add the fix tag.
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andy Shevchenko April 12, 2021, 9:23 a.m. UTC | #1
On Mon, Apr 12, 2021 at 8:32 AM Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
>
> When lidar_write_control() fails, a pairing PM usage counter
> decrement is needed to keep the counter balanced.

You forgot to collect given tags.

> Fixes: 4ac4e086fd8c5 ("iio: pulsedlight-lidar-lite: add runtime PM")
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>
> Changelog:
>
> v2: - Add the fix tag.
> ---
>  drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> index c685f10b5ae4..cc206bfa09c7 100644
> --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> @@ -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;
>         }
>
> --
> 2.17.1
>
Jonathan Cameron April 18, 2021, 9:45 a.m. UTC | #2
On Mon, 12 Apr 2021 12:23:43 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Mon, Apr 12, 2021 at 8:32 AM Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
> >
> > When lidar_write_control() fails, a pairing PM usage counter
> > decrement is needed to keep the counter balanced.  
> 
> You forgot to collect given tags.
> 
> > Fixes: 4ac4e086fd8c5 ("iio: pulsedlight-lidar-lite: add runtime PM")
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>

I gathered up the tags by hand and applied to the fixes-togreg branch of iio.git

Thanks,

Jonathan

> > ---
> >
> > Changelog:
> >
> > v2: - Add the fix tag.
> > ---
> >  drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > index c685f10b5ae4..cc206bfa09c7 100644
> > --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> > @@ -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;
> >         }
> >
> > --
> > 2.17.1
> >  
> 
>
diff mbox series

Patch

diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
index c685f10b5ae4..cc206bfa09c7 100644
--- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
+++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
@@ -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;
 	}