mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ASoC: rt5645: Fix missing free_irq
@ 2015-07-17  3:33 Koro Chen
  2015-07-17  3:33 ` [PATCH v2 2/2] ASoC: rt5645: Add regulator support Koro Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Koro Chen @ 2015-07-17  3:33 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 when snd_soc_register_codec returns error.
It does not return error when request irq failed, either.

Add return when request irq failed, and free_irq if
snd_soc_register_codec failed.

Signed-off-by: Koro Chen <koro.chen@mediatek.com>
---
Change since v1:
 - use free_irq instead of devm_request_threaded_irq
---
 sound/soc/codecs/rt5645.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 2cedf0d..56e8c31 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3401,12 +3401,23 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
 		ret = request_threaded_irq(rt5645->i2c->irq, NULL, rt5645_irq,
 			IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING
 			| IRQF_ONESHOT, "rt5645", rt5645);
-		if (ret)
+		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,
-				      rt5645_dai, ARRAY_SIZE(rt5645_dai));
+	ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5645,
+				     rt5645_dai, ARRAY_SIZE(rt5645_dai));
+	if (ret)
+		goto err_irq;
+
+	return 0;
+
+err_irq:
+	if (rt5645->i2c->irq)
+		free_irq(rt5645->i2c->irq, rt5645);
+	return ret;
 }
 
 static int rt5645_i2c_remove(struct i2c_client *i2c)
-- 
1.8.1.1.dirty


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

end of thread, other threads:[~2015-07-17  3:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-17  3:33 [PATCH v2 1/2] ASoC: rt5645: Fix missing free_irq Koro Chen
2015-07-17  3:33 ` [PATCH v2 2/2] ASoC: rt5645: Add regulator support Koro Chen

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®