From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1EC4C433E0 for ; Mon, 29 Jun 2020 01:38:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7BC5D206C3 for ; Mon, 29 Jun 2020 01:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726819AbgF2BiP (ORCPT ); Sun, 28 Jun 2020 21:38:15 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:62334 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726465AbgF2BiP (ORCPT ); Sun, 28 Jun 2020 21:38:15 -0400 Date: 29 Jun 2020 10:38:13 +0900 X-IronPort-AV: E=Sophos;i="5.75,293,1589209200"; d="scan'208";a="50575129" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 29 Jun 2020 10:38:13 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id C67B64148028; Mon, 29 Jun 2020 10:38:13 +0900 (JST) Message-ID: <87366e1wkb.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Sameer Pujar Cc: , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v4 15/23] ASoC: soc-core: Identify 'no_pcm' DAI links for DPCM In-Reply-To: <1593233625-14961-16-git-send-email-spujar@nvidia.com> References: <1593233625-14961-1-git-send-email-spujar@nvidia.com> <1593233625-14961-16-git-send-email-spujar@nvidia.com> User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sameer > PCM devices are created for dai links with 'no-pcm' flag as '0'. > Such DAI links have CPU component which implement pcm_construct() > and pcm_destruct() callbacks. Based on this, current patch exposes > a helper function to identify such components and populate 'no_pcm' > flag for DPCM DAI link. (snip) > +bool soc_component_is_pcm(struct snd_soc_dai_link_component *dlc) > +{ > + struct snd_soc_component *component; > + struct snd_soc_dai *dai; > + > + for_each_component(component) { > + if (!component->driver) > + continue; > + > + for_each_component_dais(component, dai) { > + if (!dai->name || !dlc->dai_name) > + continue; > + > + if (strcmp(dai->name, dlc->dai_name)) > + continue; We can/should NULL poinster check for "dlc->dai_name" on top of this function instead of inside loop ? And then, we can remove "dai->name" check because next strcmp() automatically fail if dai->name was NULL. Thank you for your help !! Best regards --- Kuninori Morimoto