Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandru Ardelean <ardeleanalex@gmail.com>,
	Stephan Gerhold <stephan@gerhold.net>,
	Gwendal Grignou <gwendal@chromium.org>,
	Adriana Reus <adi.reus@gmail.com>, <linux-iio@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iio: gyro: bmg160: Fix error handling in bmg160_core_probe
Date: Wed, 5 Jan 2022 13:07:43 +0000	[thread overview]
Message-ID: <20220105130743.00001661@Huawei.com> (raw)
In-Reply-To: <20220105125633.21989-1-linmq006@gmail.com>

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:


  reply	other threads:[~2022-01-05 13:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 12:56 [PATCH] iio: gyro: bmg160: Fix error handling in bmg160_core_probe Miaoqian Lin
2022-01-05 13:07 ` Jonathan Cameron [this message]
2022-01-05 13:52   ` Andy Shevchenko
2022-01-05 13:54 ` Andy Shevchenko
2022-01-06 11:23   ` [PATCH v2] iio: Fix error handling for PM Miaoqian Lin
2022-01-07 11:59     ` Andy Shevchenko
2022-01-30 14:51       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220105130743.00001661@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=adi.reus@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ardeleanalex@gmail.com \
    --cc=gwendal@chromium.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linmq006@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stephan@gerhold.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox