Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2832521pxv; Mon, 12 Jul 2021 03:03:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuxBFeNoESPktL5ZSyWl3oVkJnRV7sRk0tssx/Z1HyVzF7WKr12CjClePfHFfARBEBWZPh X-Received: by 2002:a05:6602:24d8:: with SMTP id h24mr2605164ioe.27.1626084236079; Mon, 12 Jul 2021 03:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626084236; cv=none; d=google.com; s=arc-20160816; b=vUSzXiiPJ9N/gZ66KZWb3uXRvHj/jO++KA4RUpM0/N9FJJwpjxZePynNRtpuoWIlpO zLTvWCjThW56AzjySbnkBC1J/86LrBL1t1c8DAqHXjgAW1ZOKb9lQfFgyEVugg8UDq5O z5ytAb/Wa72c1D+4FTR9llG6Br0bKwfAK69q/4aPzwyp2cRCtxtKHD9biryx2fwiIHqW R0xiixNc5rIrdIzJw2KyQrmdsMlhPZpRoSpT76hPsCBFWAy81zq/uMxWINhR9sE+8DQu 9F+J3KTBKWVXAVnvbgv8Hf6Rcm6SObtZ+J5P3eWvP9j3FyXVC3iU92RaX6GVFyyIQ85E 6IRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qEWZQeUVRjiphD5Bj5O3Q/YcuOOzzxqXPqA3xgDgZ+c=; b=tYils2tbTu/lQxs+Tb4BHk8c1r2QfegFhBUoNnytasgq4yaGsuifUOqGW6doEItsog DzfrnXho1r8NexT2WgOpP0H2DaB6gweMgl44HLH9DWaPY6uO3LGODkWQ1RsvHfEucc4k GAJWEZnc9MnsAERCPoM9zV4Djlb04wynN+GXdEdQHH0eMHULQdktLxAsYzLOXhHzn5j3 eKG+3qxF51/9V5EnUIjU6j+hXCCEg603IG/GrSsZeEyVAXk58M1mZcG3PpPx4fu+usCP xArPChhkwb4LUehduDzODXqDpiRZ4yvR9xaIm/bKI9Tcwlyk1huDNXI/dFFjtd6ThVC8 O45Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2hZZYqLm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d198si17165129jac.70.2021.07.12.03.03.44; Mon, 12 Jul 2021 03:03:56 -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=@linuxfoundation.org header.s=korg header.b=2hZZYqLm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244007AbhGLHR4 (ORCPT + 99 others); Mon, 12 Jul 2021 03:17:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:53362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239879AbhGLGxJ (ORCPT ); Mon, 12 Jul 2021 02:53:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AF6746120F; Mon, 12 Jul 2021 06:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626072620; bh=RUgYJU9lVBC2ICShtr/4xi1A1kUmM72HxXtGzTEXXgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2hZZYqLm5X8KmVUHBwveV4nfAxOeYDYkcp/fHFiYjBqw2D7PiKMh51jgHI6MB54rL zF29tJGSwHvXkBiH5ufml7+lKD1q3LqQ2keyEC0C9KVUgo9r7/wG8ziDCrJx6YBD0b 7ogGEjsZsOezzwTf1txJaNCRxmgsjWGPArKKpnOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Takashi Sakamoto , Takashi Iwai , Sasha Levin Subject: [PATCH 5.10 557/593] ALSA: firewire-lib: Fix amdtp_domain_start() when no AMDTP_OUT_STREAM stream is found Date: Mon, 12 Jul 2021 08:11:57 +0200 Message-Id: <20210712060955.806133690@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit 0cbbeaf370221fc469c95945dd3c1198865c5fe4 ] 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 Acked-by: Takashi Sakamoto Link: https://lore.kernel.org/r/9c9a53a4905984a570ba5672cbab84f2027dedc1.1624560484.git.christophe.jaillet@wanadoo.fr Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- 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 5805c5de39fb..7a282d8e7148 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -1404,14 +1404,17 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int ir_delay_cycle) unsigned int queue_size; struct amdtp_stream *s; int cycle; + bool found = false; int err; // 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