Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: rt5659: Fix irq leak

Use devm_request_threaded_irq to ensure the irq is freed when unload the
module. The rt5659->i2c is no longer used after this conversion, thus
remove it as well.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Axel Lin and committed by
Mark Brown
1ca2cf8c d3cb2de2

+4 -13
+4 -12
sound/soc/codecs/rt5659.c
··· 3985 3985 if (rt5659 == NULL) 3986 3986 return -ENOMEM; 3987 3987 3988 - rt5659->i2c = i2c; 3989 3988 i2c_set_clientdata(i2c, rt5659); 3990 3989 3991 3990 if (pdata) ··· 4156 4157 4157 4158 INIT_DELAYED_WORK(&rt5659->jack_detect_work, rt5659_jack_detect_work); 4158 4159 4159 - if (rt5659->i2c->irq) { 4160 - ret = request_threaded_irq(rt5659->i2c->irq, NULL, rt5659_irq, 4161 - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING 4160 + if (i2c->irq) { 4161 + ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL, 4162 + rt5659_irq, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING 4162 4163 | IRQF_ONESHOT, "rt5659", rt5659); 4163 4164 if (ret) 4164 4165 dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret); 4165 4166 4166 4167 } 4167 4168 4168 - ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5659, 4169 + return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5659, 4169 4170 rt5659_dai, ARRAY_SIZE(rt5659_dai)); 4170 - 4171 - if (ret) { 4172 - if (rt5659->i2c->irq) 4173 - free_irq(rt5659->i2c->irq, rt5659); 4174 - } 4175 - 4176 - return 0; 4177 4171 } 4178 4172 4179 4173 static int rt5659_i2c_remove(struct i2c_client *i2c)
-1
sound/soc/codecs/rt5659.h
··· 1792 1792 struct snd_soc_codec *codec; 1793 1793 struct rt5659_platform_data pdata; 1794 1794 struct regmap *regmap; 1795 - struct i2c_client *i2c; 1796 1795 struct gpio_desc *gpiod_ldo1_en; 1797 1796 struct gpio_desc *gpiod_reset; 1798 1797 struct snd_soc_jack *hs_jack;