linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: milo.kim@ti.com, sre@kernel.org, anton.vorontsov@linaro.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH] power: supply: lp8788: Fix an error handling path in 'lp8788_charger_probe()'
Date: Fri,  8 May 2020 09:11:50 +0200	[thread overview]
Message-ID: <20200508071150.204974-1-christophe.jaillet@wanadoo.fr> (raw)

In case of error, resources allocated in 'lp8788_setup_adc_channel()' must
be released.

Add a call to 'lp8788_release_adc_channel()' as already done in the remove
function.

Fixes: 98a276649358 ("power_supply: Add new lp8788 charger driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/power/supply/lp8788-charger.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/lp8788-charger.c b/drivers/power/supply/lp8788-charger.c
index 84a206f42a8e..641815eb24bc 100644
--- a/drivers/power/supply/lp8788-charger.c
+++ b/drivers/power/supply/lp8788-charger.c
@@ -719,13 +719,17 @@ static int lp8788_charger_probe(struct platform_device *pdev)
 
 	ret = lp8788_psy_register(pdev, pchg);
 	if (ret)
-		return ret;
+		goto err_release_adc_channel;
 
 	ret = lp8788_irq_register(pdev, pchg);
 	if (ret)
 		dev_warn(dev, "failed to register charger irq: %d\n", ret);
 
 	return 0;
+
+err_release_adc_channel:
+	lp8788_release_adc_channel(pchg);
+	return ret;
 }
 
 static int lp8788_charger_remove(struct platform_device *pdev)
-- 
2.25.1


             reply	other threads:[~2020-05-08  7:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08  7:11 Christophe JAILLET [this message]
2020-05-09  0:14 ` [PATCH] power: supply: lp8788: Fix an error handling path in 'lp8788_charger_probe()' Sebastian Reichel
2020-05-08 11:25 [PATCH] power: supply: lp8788: Fix an error handling path in lp8788_charger_probe() Markus Elfring

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=20200508071150.204974-1-christophe.jaillet@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=anton.vorontsov@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=milo.kim@ti.com \
    --cc=sre@kernel.org \
    /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).