Re: [PATCH 4.19 031/133] iio: magnetometer: ak8974: Fix runtime PM imbalance on error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> From: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> Fixes: 7c94a8b2ee8c ("iio: magn: add a driver for AK8974")
> Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> Cc: <Stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> 
> ---
>  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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux