From patchwork Wed Jul 8 08:25:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koro Chen X-Patchwork-Id: 6742581 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 744389F2F0 for ; Wed, 8 Jul 2015 08:26:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A4E6F207B2 for ; Wed, 8 Jul 2015 08:26:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7D518207B7 for ; Wed, 8 Jul 2015 08:26:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6F5AD2605E5; Wed, 8 Jul 2015 10:26:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id D37B626044D; Wed, 8 Jul 2015 10:26:25 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1883E260464; Wed, 8 Jul 2015 10:26:25 +0200 (CEST) Received: from mailgw01.mediatek.com (unknown [210.61.82.183]) by alsa0.perex.cz (Postfix) with ESMTP id 18FA026043A for ; Wed, 8 Jul 2015 10:26:16 +0200 (CEST) X-Listener-Flag: 11101 Received: from mtkhts07.mediatek.inc [(172.21.101.69)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 996525421; Wed, 08 Jul 2015 16:26:11 +0800 Received: from mtkslt301 (10.21.14.114) by mtkhts07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.181.6; Wed, 8 Jul 2015 16:26:09 +0800 Received: by mtkslt301 (Postfix, from userid 11333) id 1677E183AC2; Wed, 8 Jul 2015 16:26:10 +0800 (CST) From: Koro Chen To: , , , Date: Wed, 8 Jul 2015 16:25:50 +0800 Message-ID: <1436343951-3482-1-git-send-email-koro.chen@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 X-MTK: N Cc: oder_chiou@realtek.com, alsa-devel@alsa-project.org, srv_heupstream@mediatek.com, Koro Chen , linux-kernel@vger.kernel.org, bardliao@realtek.com Subject: [alsa-devel] [PATCH 1/2] ASoC: rt5645: Fix missing free_irq X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);