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 4A564C352A1 for ; Wed, 7 Dec 2022 16:56:06 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5CC0617B7; Wed, 7 Dec 2022 17:55:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5CC0617B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1670432164; bh=FoYXqvf/RGO8HnAjboAtBChf8PSxV22TRx7xbkHaZ/Y=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Nok/Tw+KwFsiOToEzAwIfAbTI8hTLt3ZozNxhRHqz1694TQEV0s+vXWXUuUJX3rFq 4OlG8yedoj0w0JlZ0s+HFB13cXB5kun7d050C054yo/T1YQGRyETZ/6pNhbjCYQ0Ia nN14CXqui20BKqbjMaHi4UXgkXzcr+A04xA/fEkE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 07690F8021D; Wed, 7 Dec 2022 17:55:14 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D74A2F802BE; Wed, 7 Dec 2022 17:55:12 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 93A23F800EE for ; Wed, 7 Dec 2022 17:55:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 93A23F800EE Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="v5+ooeK/"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Pnd0/mln" Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 084332002E; Wed, 7 Dec 2022 16:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1670432109; 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=oU82cZadfNpNjRFYyusw41ToDIXH3/2n/Y3r6CDEA/c=; b=v5+ooeK/VRIOlTkCIw6frGmn3/d1kyd2abLmqD4ILJ2oTvX92670mkq8hmnoXZati0J8vW FXVn9hQIOBabVuPEzGj8PpXDn3AMthwgG0Tbp7CeISg2A4gfaIQV0NVTZ6tpm6hkhHZ7bt 4oOGEuZBlXp/M1rRduuIQfhEVmpIwoE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1670432109; 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=oU82cZadfNpNjRFYyusw41ToDIXH3/2n/Y3r6CDEA/c=; b=Pnd0/mlnC/qCtF+u5STZ1BKCZAUNO3hfvGQcbUlZt4hrpAVKJaSAP/y/PFMLwHh5jHdD1H OOJ4/fLD5QGglCBA== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 imap1.suse-dmz.suse.de (Postfix) with ESMTPS id E1306134CD; Wed, 7 Dec 2022 16:55:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id t585NmzFkGOwYAAAGKfGzw (envelope-from ); Wed, 07 Dec 2022 16:55:08 +0000 Date: Wed, 07 Dec 2022 17:55:08 +0100 Message-ID: <875yen9ms3.wl-tiwai@suse.de> From: Takashi Iwai To: Cezary Rojewski Subject: Re: [bug report] ALSA: hda: Interrupt servicing and BDL setup for compress streams In-Reply-To: <8868a1c7-8bfc-5576-09f6-52af96dd26ee@intel.com> References: <8868a1c7-8bfc-5576-09f6-52af96dd26ee@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 Cc: alsa-devel@alsa-project.org, Dan Carpenter X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Wed, 07 Dec 2022 15:35:12 +0100, Cezary Rojewski wrote: > > On 2022-12-07 3:28 PM, Dan Carpenter wrote: > > Hello Cezary Rojewski, > > > > The patch 3e9582267e3a: "ALSA: hda: Interrupt servicing and BDL setup > > for compress streams" from Dec 2, 2022, leads to the following Smatch > > static checker warning: > > > > sound/hda/hdac_stream.c:544 snd_hdac_stream_setup_periods() > > error: uninitialized symbol 'dmab'. > > > > sound/hda/hdac_stream.c > > 487 int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev) > > 488 { > > 489 struct hdac_bus *bus = azx_dev->bus; > > 490 struct snd_pcm_substream *substream = azx_dev->substream; > > 491 struct snd_compr_stream *cstream = azx_dev->cstream; > > 492 struct snd_pcm_runtime *runtime = NULL; > > 493 struct snd_dma_buffer *dmab; > > 494 __le32 *bdl; > > 495 int i, ofs, periods, period_bytes; > > 496 int pos_adj, pos_align; > > 497 > > 498 if (substream) { > > 499 runtime = substream->runtime; > > 500 dmab = snd_pcm_get_dma_buf(substream); > > 501 } else if (cstream) { > > 502 dmab = snd_pcm_get_dma_buf(cstream); > > 503 } > > > > dmab is not initialized on else path. > > Hello, > > Thanks for the report. Perhaps I should just do: s/else if/else/ as > the situation with ->substream AND ->cstream being uninitialized is > invalid. > > Before support for compress stream was added in this part of the code, > it was always assumed ->substream is valid. > > So, either s/else if/else or append: > } else { > return -EINVAL; > } > > Takashi, what do you think? The return -EINVAL would be OK. As this must not happen, it can be even with WARN_ON(). thanks, Takashi