From patchwork Mon Sep 1 06:46:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiubo Li X-Patchwork-Id: 4817531 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8CA309F314 for ; Mon, 1 Sep 2014 07:38:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BBD1820170 for ; Mon, 1 Sep 2014 07:38:28 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9F98F2015D for ; Mon, 1 Sep 2014 07:38:26 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id ADD87264EE5; Mon, 1 Sep 2014 09:38:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: 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 D68612625FE; Mon, 1 Sep 2014 09:38:19 +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 94014262607; Mon, 1 Sep 2014 09:38:18 +0200 (CEST) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1lp0144.outbound.protection.outlook.com [207.46.163.144]) by alsa0.perex.cz (Postfix) with ESMTP id EB7C9261B2D for ; Mon, 1 Sep 2014 09:38:09 +0200 (CEST) Received: from BN3PR0301CA0024.namprd03.prod.outlook.com (25.160.180.162) by DM2PR0301MB0624.namprd03.prod.outlook.com (25.160.95.28) with Microsoft SMTP Server (TLS) id 15.0.1015.19; Mon, 1 Sep 2014 07:38:07 +0000 Received: from BN1BFFO11FD055.protection.gbl (2a01:111:f400:7c10::1:187) by BN3PR0301CA0024.outlook.office365.com (2a01:111:e400:4000::34) with Microsoft SMTP Server (TLS) id 15.0.1015.19 via Frontend Transport; Mon, 1 Sep 2014 07:38:06 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD055.mail.protection.outlook.com (10.58.145.10) with Microsoft SMTP Server (TLS) id 15.0.1010.11 via Frontend Transport; Mon, 1 Sep 2014 07:38:06 +0000 Received: from rock.ap.freescale.net (rock.ap.freescale.net [10.193.20.106]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s817bsKW022506; Mon, 1 Sep 2014 00:37:55 -0700 From: Xiubo Li To: , , , , , , , Date: Mon, 1 Sep 2014 14:46:52 +0800 Message-ID: <1409554012-1427-1-git-send-email-Li.Xiubo@freescale.com> X-Mailer: git-send-email 1.8.4 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(189002)(199003)(77982001)(68736004)(87936001)(95666004)(2201001)(97736001)(4396001)(106466001)(74662001)(105606002)(104166001)(92566001)(86362001)(92726001)(89996001)(83322001)(44976005)(69596002)(93916002)(26826002)(48376002)(81156004)(88136002)(19580405001)(83072002)(85852003)(6806004)(79102001)(77156001)(102836001)(19580395003)(50226001)(74502001)(90102001)(84676001)(229853001)(64706001)(50986999)(36756003)(85306004)(81542001)(46102001)(107046002)(50466002)(20776003)(31966008)(76482001)(21056001)(62966002)(87286001)(99396002)(104016003)(81342001)(47776003)(80022001)(15866825004); DIR:OUT; SFP:; SCL:1; SRVR:DM2PR0301MB0624; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:; X-Forefront-PRVS: 03218BFD9F Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=Li.Xiubo@freescale.com; X-OriginatorOrg: freescale.com Cc: Xiubo Li , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCHv3] ASoC: simple-card: Fix bug of wrong decrement DT node's refcount 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 DAI links's cpu_of_node's and codec_of_node's refcounts shouldn't be decremented immediately at the end of the probe() fucntion. Because we will still use them before the audio card is removed. Signed-off-by: Xiubo Li Cc: Jean-Francois Moine --- Change in v3: - Follow Jean-Francois Moine's advice. - Remove the following patch: "ASoC: simple-card: Fix bug of forgetting decrement DT node's refcount" sound/soc/generic/simple-card.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index fd8b045..986d2c7 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -481,12 +481,19 @@ static int asoc_simple_card_probe(struct platform_device *pdev) snd_soc_card_set_drvdata(&priv->snd_card, priv); ret = devm_snd_soc_register_card(&pdev->dev, &priv->snd_card); + if (ret >= 0) + return ret; err: asoc_simple_card_unref(pdev); return ret; } +static int asoc_simple_card_remove(struct platform_device *pdev) +{ + return asoc_simple_card_unref(pdev); +} + static const struct of_device_id asoc_simple_of_match[] = { { .compatible = "simple-audio-card", }, {}, @@ -500,6 +507,7 @@ static struct platform_driver asoc_simple_card = { .of_match_table = asoc_simple_of_match, }, .probe = asoc_simple_card_probe, + .remove = asoc_simple_card_remove, }; module_platform_driver(asoc_simple_card);