lkml.org 
[lkml]   [2020]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4.19 031/133] iio: magnetometer: ak8974: Fix runtime PM imbalance on error
Hi!

> From: Dinghao Liu <dinghao.liu@zju.edu.cn>
>
> commit 0187294d227dfc42889e1da8f8ce1e44fc25f147 upstream.
>
> When devm_regmap_init_i2c() returns an error code, a pairing
> runtime PM usage counter decrement is needed to keep the
> counter balanced. For error paths after ak8974_set_power(),
> ak8974_detect() and ak8974_reset(), things are the same.
>
> However, When iio_triggered_buffer_setup() returns an error
> code, there will be two PM usgae counter decrements.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> Fixes: 7c94a8b2ee8c ("iio: magn: add a driver for AK8974")
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Cc: <Stable@vger.kernel.org>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> ---
> drivers/iio/magnetometer/ak8974.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> --- a/drivers/iio/magnetometer/ak8974.c
> +++ b/drivers/iio/magnetometer/ak8974.c
> @@ -768,19 +768,21 @@ static int ak8974_probe(struct i2c_clien
> ak8974->map = devm_regmap_init_i2c(i2c, &ak8974_regmap_config);
> if (IS_ERR(ak8974->map)) {
> dev_err(&i2c->dev, "failed to allocate register map\n");
> + pm_runtime_put_noidle(&i2c->dev);
> + pm_runtime_disable(&i2c->dev);
> return PTR_ERR(ak8974->map);
> }

This misses regulator_bulk_disable(), afaict. I believe it can be
refactored to use common exit...?

Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-07-22 13:26    [W:0.838 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site