lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200722112629.GA22052@duo.ucw.cz>
Date:   Wed, 22 Jul 2020 13:26:29 +0200
From:   Pavel Machek <pavel@...x.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Dinghao Liu <dinghao.liu@....edu.cn>,
        Linus Walleij <linus.walleij@...aro.org>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH 4.19 031/133] iio: magnetometer: ak8974: Fix runtime PM
 imbalance on error

Hi!

> From: Dinghao Liu <dinghao.liu@....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@....edu.cn>
> Fixes: 7c94a8b2ee8c ("iio: magn: add a driver for AK8974")
> Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
> Cc: <Stable@...r.kernel.org>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.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

Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ