From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C86C6392C4C for ; Mon, 9 Mar 2026 12:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773060912; cv=none; b=RSMK5fstIzMIoNoBiuIA7OTi2YE82MZ7zW79aqGp+sEr/PBkXYnIQXlEDNJ4XbrYDIETyPaaJE8/TNH9boPNUsBvnsSlmZGgdTThTJZYXB7TTdnzxxzMshzULE9KJczAGP65wxFlEFZtsTLqpMG2vqU4ddJi0z2DAJFPJ6cDhso= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773060912; c=relaxed/simple; bh=6F4tYFxIxl5jUs6uiWf8XdWz74jtj5fTeJj1oAJexMw=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=PK6qiLNUQaSKH7ThOE460vZH2RaBWru8J3u5OvAolMBfOPtsHs6urotx95036njmz1HnrMZ4J9gAMD/U6NA5jZq+cyDAa+Tf/KbBgEatLJVAvEAlFXfZ9I6vNPbhBqxWQ/Iirql0yLDtPoXiMEZp7dflUwT4vJM7DXbaOgjqzLM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=p8qmf8wM; arc=none smtp.client-ip=95.215.58.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="p8qmf8wM" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1773060908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+RwK8RR51qXeZ71e+SyZvIcyWk9REBek1JHzsr0gp2E=; b=p8qmf8wMnjquqbtDjCeFlkv0g/rwvbNPeTR18zkEYenETkIXumccUggucGa0zgF6GLFLib djNVfvGk4X/ruI12bGeiJmIWq/w/TeASL0uz2CUP4SvuXjw4HSrvbgcBOJSUbD//EuWvQm 6+dP7/V+lRP4TfPb+t+51d5aiGXV3nY= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81.1.4\)) Subject: Re: [PATCH] ALSA: aoa: Handle empty codec list in i2sbus_pcm_prepare() X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Thorsten Blum In-Reply-To: <87zf4hmcw4.wl-tiwai@suse.de> Date: Mon, 9 Mar 2026 13:55:02 +0100 Cc: Johannes Berg , Jaroslav Kysela , Takashi Iwai , Kees Cook , stable@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: References: <20260309114159.765304-3-thorsten.blum@linux.dev> <87zf4hmcw4.wl-tiwai@suse.de> To: Takashi Iwai X-Migadu-Flow: FLOW_OUT On 9. Mar 2026, at 12:59, Takashi Iwai wrote: > On Mon, 09 Mar 2026 12:41:59 +0100, Thorsten Blum wrote: >> Replace two list_for_each_entry() loops with list_first_entry_or_null() >> in i2sbus_pcm_prepare(). > > Hmm, I guess both can be simply list_first_entry(), as the codec list > in this code path is guaranteed to be non-empty (it's called after > i2sbus_pcm_open() which has the check of the valid codecs). That guarantee only holds for open/prepare, not for i2sbus_resume() via i2sbus_pcm_prepare_both(). It's probably uncommon in practice, but i2sbus_pcm_prepare() should still handle it safely. >> Handle an empty codec list explicitly by returning -ENODEV, which avoids >> using uninitialized 'bi.sysclock_factor' in the 32-bit code path. > > Which 32bit code path are you referring to...? The SNDRV_PCM_FORMAT_S32_BE/SNDRV_PCM_FORMAT_U32_BE branch. Thanks, Thorsten