lkml.org 
[lkml]   [2022]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] iio: gyro: bmg160: Fix error handling in bmg160_core_probe
On Wed,  5 Jan 2022 12:56:30 +0000
Miaoqian Lin <linmq006@gmail.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@gmail.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:

\
 
 \ /
  Last update: 2022-01-05 14:08    [W:0.053 / U:0.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site