mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: rt5645: Fix missing free_irq
@ 2015-07-08  8:25 Koro Chen
  2015-07-08  8:25 ` [PATCH 2/2] ASoC: rt5645: Add regulator support Koro Chen
  2015-07-08 11:14 ` [PATCH 1/2] ASoC: rt5645: Fix missing free_irq Mark Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Koro Chen @ 2015-07-08  8:25 UTC (permalink / raw)
  To: broonie, perex, tiwai, lgirdwood
  Cc: srv_heupstream, linux-kernel, alsa-devel, bardliao, oder_chiou,
	Koro Chen

The driver does not free irq if snd_soc_register_codec fails.
It does not return error when request irq failed, either.
Fix this by using devm_request_threaded_irq(), and returns when error.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
---
 sound/soc/codecs/rt5645.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 9dfa431..f9f2db8 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3427,11 +3427,15 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
 	INIT_DELAYED_WORK(&rt5645->jack_detect_work, rt5645_jack_detect_work);
 
 	if (rt5645->i2c->irq) {
-		ret = request_threaded_irq(rt5645->i2c->irq, NULL, rt5645_irq,
-			IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING
-			| IRQF_ONESHOT, "rt5645", rt5645);
-		if (ret)
+		ret = devm_request_threaded_irq(&i2c->dev, rt5645->i2c->irq,
+						NULL, rt5645_irq,
+						IRQF_TRIGGER_RISING |
+						IRQF_TRIGGER_FALLING |
+						IRQF_ONESHOT, "rt5645", rt5645);
+		if (ret) {
 			dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret);
+			return ret;
+		}
 	}
 
 	return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5645,
@@ -3442,9 +3446,6 @@ static int rt5645_i2c_remove(struct i2c_client *i2c)
 {
 	struct rt5645_priv *rt5645 = i2c_get_clientdata(i2c);
 
-	if (i2c->irq)
-		free_irq(i2c->irq, rt5645);
-
 	cancel_delayed_work_sync(&rt5645->jack_detect_work);
 
 	snd_soc_unregister_codec(&i2c->dev);
-- 
1.8.1.1.dirty


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-07-13 15:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-08  8:25 [PATCH 1/2] ASoC: rt5645: Fix missing free_irq Koro Chen
2015-07-08  8:25 ` [PATCH 2/2] ASoC: rt5645: Add regulator support Koro Chen
2015-07-08 11:14 ` [PATCH 1/2] ASoC: rt5645: Fix missing free_irq Mark Brown
2015-07-09  1:48   ` Koro Chen
2015-07-09 11:10     ` Mark Brown
2015-07-10 14:43       ` Koro Chen
2015-07-13 15:00         ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®