alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Chuhong Yuan <hslester96@gmail.com>
Cc: alsa-devel@alsa-project.org, patches@opensource.cirrus.com,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH] ASoC: wm2200: add missed operations in remove and probe failure
Date: Mon, 18 Nov 2019 11:57:47 +0000	[thread overview]
Message-ID: <20191118115747.GG10439@ediswmail.ad.cirrus.com> (raw)
In-Reply-To: <20191118073633.28237-1-hslester96@gmail.com>

On Mon, Nov 18, 2019 at 03:36:33PM +0800, Chuhong Yuan wrote:
> This driver misses calls to pm_runtime_disable and regulator_bulk_disable
> in remove and a call to free_irq in probe failure.
> Add the calls to fix it.
> 
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---
>  sound/soc/codecs/wm2200.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
> index cf64e109c658..7b087d94141b 100644
> --- a/sound/soc/codecs/wm2200.c
> +++ b/sound/soc/codecs/wm2200.c
> @@ -2410,6 +2410,8 @@ static int wm2200_i2c_probe(struct i2c_client *i2c,
>  
>  err_pm_runtime:
>  	pm_runtime_disable(&i2c->dev);
> +	if (i2c->irq)
> +		free_irq(i2c->irq, wm2200);

Might be worth also adding a return if the request of the IRQ
fails. We will get a large WARN in the log if the IRQ request
failed, then we fall down this error path.

>  err_reset:
>  	if (wm2200->pdata.reset)
>  		gpio_set_value_cansleep(wm2200->pdata.reset, 0);
> @@ -2426,12 +2428,15 @@ static int wm2200_i2c_remove(struct i2c_client *i2c)
>  {
>  	struct wm2200_priv *wm2200 = i2c_get_clientdata(i2c);
>  
> +	pm_runtime_disable(&i2c->dev);
>  	if (i2c->irq)
>  		free_irq(i2c->irq, wm2200);
>  	if (wm2200->pdata.reset)
>  		gpio_set_value_cansleep(wm2200->pdata.reset, 0);
>  	if (wm2200->pdata.ldo_ena)
>  		gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0);
> +	regulator_bulk_disable(ARRAY_SIZE(wm2200->core_supplies),
> +			       wm2200->core_supplies);

This one is a bit trickier since this regulator is being
controlled by PM runtime, and I don't think it necessarily leaves
things in an enabled state when it is disabled.

Thanks,
Charles
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2019-11-18 11:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18  7:36 [alsa-devel] [PATCH] ASoC: wm2200: add missed operations in remove and probe failure Chuhong Yuan
2019-11-18 11:57 ` Charles Keepax [this message]
2019-11-18 13:00 ` [alsa-devel] Applied "ASoC: wm2200: add missed operations in remove and probe failure" to the asoc tree Mark Brown

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=20191118115747.GG10439@ediswmail.ad.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=hslester96@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    /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;
as well as URLs for NNTP newsgroup(s).