LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: myungjoo.ham@samsung.com, patches@opensource.cirrus.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] extcon: arizona: Correct error handling on regmap_update_bits_check
Date: Thu, 30 May 2019 10:05:39 +0900 [thread overview]
Message-ID: <a67dc2eb-a8ce-9720-3cf9-fe179aa8c8a1@samsung.com> (raw)
In-Reply-To: <20190529094605.9838-1-ckeepax@opensource.cirrus.com>
Hi Charles,
On 19. 5. 29. 오후 6:46, Charles Keepax wrote:
> Ensure the case when regmap_update_bits_check fails and the change
> variable is not updated is handled correctly.
>
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
>
> Changes since v1:
> - Print error message in driver remove
>
> Thanks,
> Charles
>
> drivers/extcon/extcon-arizona.c | 33 ++++++++++++++++++++-------------
> 1 file changed, 20 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index 9327479c719c2..519e89aedd4a0 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -335,10 +335,12 @@ static void arizona_start_mic(struct arizona_extcon_info *info)
>
> arizona_extcon_pulse_micbias(info);
>
> - regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1,
> - ARIZONA_MICD_ENA, ARIZONA_MICD_ENA,
> - &change);
> - if (!change) {
> + ret = regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1,
> + ARIZONA_MICD_ENA, ARIZONA_MICD_ENA,
> + &change);
> + if (ret < 0) {
> + dev_err(arizona->dev, "Failed to enable micd: %d\n", ret);
> + } else if (!change) {
> regulator_disable(info->micvdd);
> pm_runtime_put_autosuspend(info->dev);
> }
> @@ -350,12 +352,14 @@ static void arizona_stop_mic(struct arizona_extcon_info *info)
> const char *widget = arizona_extcon_get_micbias(info);
> struct snd_soc_dapm_context *dapm = arizona->dapm;
> struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
> - bool change;
> + bool change = false;
> int ret;
>
> - regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1,
> - ARIZONA_MICD_ENA, 0,
> - &change);
> + ret = regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1,
> + ARIZONA_MICD_ENA, 0,
> + &change);
> + if (ret < 0)
> + dev_err(arizona->dev, "Failed to disable micd: %d\n", ret);
>
> ret = snd_soc_component_disable_pin(component, widget);
> if (ret != 0)
> @@ -1727,12 +1731,15 @@ static int arizona_extcon_remove(struct platform_device *pdev)
> struct arizona *arizona = info->arizona;
> int jack_irq_rise, jack_irq_fall;
> bool change;
> + int ret;
>
> - regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1,
> - ARIZONA_MICD_ENA, 0,
> - &change);
> -
> - if (change) {
> + ret = regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1,
> + ARIZONA_MICD_ENA, 0,
> + &change);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "Failed to disable micd on remove: %d\n",
> + ret);
> + } else if (change) {
> regulator_disable(info->micvdd);
> pm_runtime_put(info->dev);
> }
>
Applied it. Thanks.
--
Best Regards,
Chanwoo Choi
Samsung Electronics
prev parent reply other threads:[~2019-05-30 1:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190529094610epcas5p35754e16753663dfa2ecadf0e410d619a@epcas5p3.samsung.com>
2019-05-29 9:46 ` Charles Keepax
2019-05-30 1:05 ` Chanwoo Choi [this message]
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=a67dc2eb-a8ce-9720-3cf9-fe179aa8c8a1@samsung.com \
--to=cw00.choi@samsung.com \
--cc=ckeepax@opensource.cirrus.com \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=patches@opensource.cirrus.com \
--subject='Re: [PATCH v2] extcon: arizona: Correct error handling on regmap_update_bits_check' \
/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
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).