From patchwork Mon Apr 21 11:14:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 4023651 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 497859F387 for ; Mon, 21 Apr 2014 11:13:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7BDAE202FE for ; Mon, 21 Apr 2014 11:13:24 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 656B020212 for ; Mon, 21 Apr 2014 11:13:23 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6A87E261A95; Mon, 21 Apr 2014 13:13:21 +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 F04FC2617B8; Mon, 21 Apr 2014 13:13:15 +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 43CCB2617BB; Mon, 21 Apr 2014 13:13:15 +0200 (CEST) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1lp0145.outbound.protection.outlook.com [207.46.163.145]) by alsa0.perex.cz (Postfix) with ESMTP id CF3622617B8 for ; Mon, 21 Apr 2014 13:13:06 +0200 (CEST) Received: from DM2PR03CA005.namprd03.prod.outlook.com (10.141.52.153) by BY2PR03MB028.namprd03.prod.outlook.com (10.255.240.42) with Microsoft SMTP Server (TLS) id 15.0.921.12; Mon, 21 Apr 2014 11:13:03 +0000 Received: from BN1AFFO11FD058.protection.gbl (2a01:111:f400:7c10::124) by DM2PR03CA005.outlook.office365.com (2a01:111:e400:2414::25) with Microsoft SMTP Server (TLS) id 15.0.921.12 via Frontend Transport; Mon, 21 Apr 2014 11:13:03 +0000 Received: from az84smr01.freescale.net (192.88.158.246) by BN1AFFO11FD058.mail.protection.outlook.com (10.58.53.73) with Microsoft SMTP Server (TLS) id 15.0.929.8 via Frontend Transport; Mon, 21 Apr 2014 11:13:03 +0000 Received: from rio.ap.freescale.net (rio.ap.freescale.net [10.192.242.9]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s3LBCvTP028692; Mon, 21 Apr 2014 04:12:58 -0700 From: Nicolin Chen To: Date: Mon, 21 Apr 2014 19:14:46 +0800 Message-ID: <1398078886-31505-1-git-send-email-Guangyu.Chen@freescale.com> X-Mailer: git-send-email 1.8.4 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.246; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009001)(6009001)(428001)(189002)(199002)(81342001)(50226001)(93916002)(36756003)(46102001)(62966002)(4396001)(81542001)(50986999)(47776003)(20776003)(80022001)(76482001)(48376002)(86362001)(92566001)(77096999)(92726001)(50466002)(83072002)(89996001)(99396002)(87936001)(79102001)(88136002)(77982001)(6806004)(31966008)(74502001)(85852003)(87286001)(74662001)(77156001)(19580395003)(83322001)(19580405001)(80976001)(44976005); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB028; H:az84smr01.freescale.net; FPR:3A5DDE31.2C96C588.41E73F7F.86EEEA72.201F5; MLV:sfv; PTR:gate-az5.freescale.com; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Forefront-PRVS: 0188D66E61 Received-SPF: None (: freescale.com does not designate permitted sender hosts) X-OriginatorOrg: freescale.com Cc: tiwai@suse.de, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, lgirdwood@gmail.com Subject: [alsa-devel] [PATCH] ASoC: core: Don't break component searching if both id and num_dai are 0 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 commit e41975ed (ASoC: core: Fix the DAI name getting) added a break within the "if (id < 0 || id >= pos->num_dai)" while the original design of the search didn't break the loop if that condition contented but only mark the ret error and let it go on to search the next component. In a case like dmaengine which's not a dai but as a component sharing an identical name with a dai, both the id and pos->num_dai here could be 0. If we break the search, we may never find the dai we want as it might be placed behind its dmaengine in the component list. So this patch fixes the issue above by following the original design to let the search carry on. Signed-off-by: Nicolin Chen --- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a17c047..82e9fdf 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -4591,7 +4591,7 @@ int snd_soc_of_get_dai_name(struct device_node *of_node, if (id < 0 || id >= pos->num_dai) { ret = -EINVAL; - break; + continue; } ret = 0;