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 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E66EC6FD1D for ; Thu, 30 Mar 2023 15:52:54 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3C0F11F1; Thu, 30 Mar 2023 17:52:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3C0F11F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1680191572; bh=BSUfJfr83wX9l4HrIiQobhzo1rcuyRmRcqPrz4EvtpU=; h=Date:From:To:Subject:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=FKfcwH0i7zEyImvajL1TUQF4yr2ZnQID/t7etf+nTvVHulMXRly1fJ3FKUE5i/jJU t6pUXMbPOKCVxlj6jUjBCwlk9sWkgDNVt837WcEK7zGTHmMMU0KtjR4wBNU4D4Iq+q yAuOMpHp5YR93t7H1VQrpA11GI03xaHVFeloLB9Y= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A66F0F80272; Thu, 30 Mar 2023 17:51:39 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1CF12F80272; Thu, 30 Mar 2023 17:51:34 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 15322F80249 for ; Thu, 30 Mar 2023 17:51:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 15322F80249 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=apklYUU9; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xGYNFdYt Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3FE0E1FE12; Thu, 30 Mar 2023 15:51:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680191486; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9bk6llO7HTeW/P1KTvZtZjBozqqI5PJsCukncdMWzxU=; b=apklYUU9YnljJxMXSVTDL9IVfzkD+ydOtkS2IVYrbf1Pyjt7RbDfcLrWIYpAxH1DLNUh75 bk4QMxscoXgtIrm4udhAcCR5/NOEUFBpDLZXEhNw9W3lBT7fd4zz99B31dxc+s4G04YWMG QgfIqjP4bOx1CucGlIdj+1IgvnBpvOA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680191486; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9bk6llO7HTeW/P1KTvZtZjBozqqI5PJsCukncdMWzxU=; b=xGYNFdYtQYY3DtFo2iB0n2M02bgmJfq8swBvwqHlveMFguekKf2dDqDCaUkQT2rP1VEl1H odj1/etuObqMwhCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0EDE91348E; Thu, 30 Mar 2023 15:51:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VhDGAv6vJWQ3WAAAMHmgww (envelope-from ); Thu, 30 Mar 2023 15:51:26 +0000 Date: Thu, 30 Mar 2023 17:51:25 +0200 Message-ID: <87bkkakzk2.wl-tiwai@suse.de> From: Takashi Iwai To: Peter Ujfalusi Subject: Re: [PATCH 06/18] ASoC: SOF: Intel: hda-mlink: add structures to parse ALT links In-Reply-To: <20230327112931.23411-7-peter.ujfalusi@linux.intel.com> References: <20230327112931.23411-1-peter.ujfalusi@linux.intel.com> <20230327112931.23411-7-peter.ujfalusi@linux.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Message-ID-Hash: KQB5ZNFXLISERHRSZONOPYPTY4XRPAK2 X-Message-ID-Hash: KQB5ZNFXLISERHRSZONOPYPTY4XRPAK2 X-MailFrom: tiwai@suse.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: lgirdwood@gmail.com, broonie@kernel.org, alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, rander.wang@intel.com X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, 27 Mar 2023 13:29:19 +0200, Peter Ujfalusi wrote: > > int hda_bus_ml_get_capabilities(struct hdac_bus *bus) > { > - if (bus->mlcap) > - return snd_hdac_ext_bus_get_ml_capabilities(bus); > + u32 link_count; > + int ret; > + int i; > + > + if (!bus->mlcap) > + return 0; > + > + link_count = readl(bus->mlcap + AZX_REG_ML_MLCD) + 1; > + > + dev_dbg(bus->dev, "HDAudio Multi-Link count: %d\n", link_count); > + > + for (i = 0; i < link_count; i++) { > + ret = hda_ml_alloc_h2link(bus, i); > + if (ret < 0) { > + hda_bus_ml_free(bus); > + return ret; > + } > + } > return 0; This makes that each call of hda_bus_ml_get_capabilities() adds the h2link entries blindly. If the driver calls it multiple times mistakenly (the function name sounds as if it's just a helper to query the capability bits), it'll lead to doubly entries. Maybe adding some check would be safer, IMO. thanks, Takashi