Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp904775pxv; Fri, 25 Jun 2021 00:40:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpt8gAR/XIC4MX5RNx4ifacWMKf9i1e5P20B2OEtnUisWh5jaq0NXqfhqfExRFLGlpihHu X-Received: by 2002:a17:906:6ad3:: with SMTP id q19mr9294356ejs.11.1624606811625; Fri, 25 Jun 2021 00:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624606811; cv=none; d=google.com; s=arc-20160816; b=yS+jOaN3Es87lmpBCVN+d8Xyjkll0ktn5aVMUPYOXZpMBgGH8ssWZ+sUOnkcvA4BHP uoKSKA8xToEtpeAo5h4Yy/G3hFnVTaO3oEYojeRL/X1yimNk5trTaDJ/3KbwWaCBPDro AOEXxSqUjouNdbSpwWIC/mi5GhGuH6Nuxrtw6pNr6qMcuDVBv8r5eQvhclB3dlIfGf2u jMG87PCsKB57DIKojB1dcdftJC87HTyJS/wQTyBO5HyziKZ5LsI6m4XaR6JnhAR4jalS sNKzQ5HWWvR5mjDyY/YsU0kQ0rNOe6K5tFPi9rEbCBAfvtUf6RW8GV9l0uOsPTRKf47J OP3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=nnuofijrl6RYEFo+SFPGi5DMa5lFhRBvWdO4DS6T/+U=; b=se1zIa3FVMaXrPHa4Tbw45qu86ey5lTVw+i130BR1JjvB/WRvU2fXkHACD3NFersCe 3KadY3iQVyaXnliVdbFcfbe+JdXrTpCciHOY6LbqlNfBKZWFfqXOM7qRjlJqpEBeza7R kKFIJfDX5D6E6qWMvxggM/FoT5EIO8Lzphp1lWGcc1ohIsSNTku9lsZU3W9UCDruNJ67 YBerqr6OOcmB8e0C/LeaIGwAcryTbKzZIwkKvmBBNSZGAlm57koaz65tZQWCFXKRSU+u 35UDtvhVnHsWX4hYaZJclFXMQx4x13L9YOjmQRh5uXDxW6YaiT08sqnk4F7+sOTDG0Yt ElTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=vEuo9Nsy; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=WTKkbJVi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p4si6132947edj.420.2021.06.25.00.39.47; Fri, 25 Jun 2021 00:40:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=vEuo9Nsy; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=WTKkbJVi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230025AbhFYHky (ORCPT + 99 others); Fri, 25 Jun 2021 03:40:54 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:34700 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229906AbhFYHkt (ORCPT ); Fri, 25 Jun 2021 03:40:49 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 3B2F721C01; Fri, 25 Jun 2021 07:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1624606708; 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=nnuofijrl6RYEFo+SFPGi5DMa5lFhRBvWdO4DS6T/+U=; b=vEuo9NsyGr+cpk9/T9Oi+8amIT5p6qH1c8/d+FX686CYu0U//vzniKvYnHilyV8Id69HOj hg5Q8ux54N44TOI55Z5LGIpYvMovuz7RlKMKqR5KgvT4Tn5zLWMfvZv7/CGQak42rrqLFP X6OOzpIQrThIzWsL9FGN5HwvTYVdxHk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1624606708; 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=nnuofijrl6RYEFo+SFPGi5DMa5lFhRBvWdO4DS6T/+U=; b=WTKkbJVi6TeYOQSW2lEK8FsvSkE2tasxsltYBEAL13LnawAU2wmKPEGGb26GdUsVKe9UvI /LDYfu8+WMBiLbDw== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 02865A3BB4; Fri, 25 Jun 2021 07:38:27 +0000 (UTC) Date: Fri, 25 Jun 2021 09:38:27 +0200 Message-ID: From: Takashi Iwai To: Christophe JAILLET Cc: clemens@ladisch.de, o-takashi@sakamocchi.jp, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] ALSA: firewire-lib: Fix 'amdtp_domain_start()' when no AMDTP_OUT_STREAM stream is found In-Reply-To: <9c9a53a4905984a570ba5672cbab84f2027dedc1.1624560484.git.christophe.jaillet@wanadoo.fr> References: <9c9a53a4905984a570ba5672cbab84f2027dedc1.1624560484.git.christophe.jaillet@wanadoo.fr> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Jun 2021 20:49:36 +0200, Christophe JAILLET wrote: > > The intent here is to return an error code if we don't find what we are > looking for in the 'list_for_each_entry()' loop. > > 's' is not NULL if the list is empty or if we scan the complete list. > Introduce a new 'found' variable to handle such cases. > > Fixes: 60dd49298ec5 ("ALSA: firewire-lib: handle several AMDTP streams in callback handler of IRQ target") > Signed-off-by: Christophe JAILLET Applied now. Thanks. Takashi > --- > We could test with" if (list_entry_is_head(s, &d->streams, list))" > instead, but I find it much less readable. > --- > sound/firewire/amdtp-stream.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c > index aad9778d1c4d..9be2260e4ca2 100644 > --- a/sound/firewire/amdtp-stream.c > +++ b/sound/firewire/amdtp-stream.c > @@ -1943,6 +1943,7 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int tx_init_skip_cycles, > unsigned int events_per_period = d->events_per_period; > unsigned int queue_size; > struct amdtp_stream *s; > + bool found = false; > int err; > > if (replay_seq) { > @@ -1955,10 +1956,12 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int tx_init_skip_cycles, > > // Select an IT context as IRQ target. > list_for_each_entry(s, &d->streams, list) { > - if (s->direction == AMDTP_OUT_STREAM) > + if (s->direction == AMDTP_OUT_STREAM) { > + found = true; > break; > + } > } > - if (!s) > + if (!found) > return -ENXIO; > d->irq_target = s; > > -- > 2.30.2 >