diff options
author | Koro Chen <koro.chen@mediatek.com> | 2015-07-17 05:33:11 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-17 13:16:01 +0200 |
commit | 5168c5476a07233ecafaed0effaa59859327e366 (patch) | |
tree | a70a79dca6b37ec8d1cc322e8ea4f74b8427ed9a /sound/soc/codecs/rt5645.c | |
parent | ASoC: rt5645: Remove unused rt5645 variable (diff) | |
download | linux-5168c5476a07233ecafaed0effaa59859327e366.tar.xz linux-5168c5476a07233ecafaed0effaa59859327e366.zip |
ASoC: rt5645: Fix missing free_irq
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/rt5645.c')
-rw-r--r-- | sound/soc/codecs/rt5645.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index c16adf4bac0d..827e3bf82d29 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3397,12 +3397,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) |