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]
Date:   Wed, 5 Jan 2022 13:07:43 +0000
From:   Jonathan Cameron <Jonathan.Cameron@...wei.com>
To:     Miaoqian Lin <linmq006@...il.com>
CC:     Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Alexandru Ardelean <ardeleanalex@...il.com>,
        Stephan Gerhold <stephan@...hold.net>,
        Gwendal Grignou <gwendal@...omium.org>,
        Adriana Reus <adi.reus@...il.com>, <linux-iio@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio: gyro: bmg160: Fix error handling in
 bmg160_core_probe

On Wed,  5 Jan 2022 12:56:30 +0000
Miaoqian Lin <linmq006@...il.com> wrote:

> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable(). In the PM Runtime docs:
>     Drivers in ->remove() callback should undo the runtime PM changes done
>     in ->probe(). Usually this means calling pm_runtime_disable(),
>     pm_runtime_dont_use_autosuspend() etc.
> We should do this in error handling.
> 
> Fixes: 7d0ead5 ("iio: Reconcile operation order between iio_register/unregister and pm functions")

Hi Miaoqian,

Please check this fixes tag against the format it should have.

Thanks,

Jonathan


> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
>  drivers/iio/gyro/bmg160_core.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c
> index 17b939a367ad..81a6d09788bd 100644
> --- a/drivers/iio/gyro/bmg160_core.c
> +++ b/drivers/iio/gyro/bmg160_core.c
> @@ -1188,11 +1188,14 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq,
>  	ret = iio_device_register(indio_dev);
>  	if (ret < 0) {
>  		dev_err(dev, "unable to register iio device\n");
> -		goto err_buffer_cleanup;
> +		goto err_pm_cleanup;
>  	}
>  
>  	return 0;
>  
> +err_pm_cleanup:
> +	pm_runtime_dont_use_autosuspend(dev);
> +	pm_runtime_disable(dev);
>  err_buffer_cleanup:
>  	iio_triggered_buffer_cleanup(indio_dev);
>  err_trigger_unregister:

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ