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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B820C433F5 for ; Sun, 12 Dec 2021 09:00:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229916AbhLLJAf (ORCPT ); Sun, 12 Dec 2021 04:00:35 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:57008 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbhLLJAf (ORCPT ); Sun, 12 Dec 2021 04:00:35 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 159511F3AF; Sun, 12 Dec 2021 09:00:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1639299634; 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=l6AWHjo6PQ4BPF1NmbEadN6JkpBp7NJYDqAaABlQrJA=; b=yO4T3trLR3Y7Qtb5BPXdQ71UqgUWjx/BALtPjZVb7AiAUgPTNiDKOf1EZzLxDlYzyWreGE YfCwdyZsActTG5kCj5ZkvCjxyBeAznxpewO8esAwMRvcxJabMJvzX9IBImEuMP0NJvZg9n Fx/Q4IGU1MdJ9scAfKPaF7ba8R1TkF4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1639299634; 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=l6AWHjo6PQ4BPF1NmbEadN6JkpBp7NJYDqAaABlQrJA=; b=jY0NFM1MnKr1TmAVxEHgQN4018OzeYqQnSGampGhlJitezM95HRntOoS1GEupEz6mzhcEm veGwFkyGeIBN0zDA== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id D267DA3B83; Sun, 12 Dec 2021 09:00:33 +0000 (UTC) Date: Sun, 12 Dec 2021 10:00:33 +0100 Message-ID: From: Takashi Iwai To: "Colin King (gmail)" Cc: Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, Pierre-Louis Bossart , "linux-kernel@vger.kernel.org" Subject: Re: ALSA: drivers: opl3: assignment of a pointer that is not used, probable bug In-Reply-To: References: 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 Sat, 11 Dec 2021 19:19:30 +0100, Colin King (gmail) wrote: > > Hi, > > static analysis with scan-build has found an assignment to vp2 that is > never used in function snd_opl3_note_on(), > sound/drivers/opl3/opl3_midi.c as follows: > > if (instr_4op) { > vp2 = &opl3->voices[voice + 3]; > if (vp->state > 0) { > opl3_reg = reg_side | (OPL3_REG_KEYON_BLOCK + > voice_offset + 3); > reg_val = vp->keyon_reg & ~OPL3_KEYON_BIT; > opl3->command(opl3, opl3_reg, reg_val); > } > } > > sound/drivers/opl3/opl3_midi.c:399:3: warning: Value stored to 'vp2' > is never read [deadcode.DeadStores] > vp2 = &opl3->voices[voice + 3]; > ^ ~~~~~~~~~~~~~~~~~~~~~~~~ > > I suspect that references to vp in this if block should be to vp2, but > I'm unsure if that is for all references or not, hence I'm reporting > this issue. Yes, the next vp->state > 0 check must be vp2->state > 0. Care to submit a proper fix patch? Thanks! Takashi