* ALSA: drivers: opl3: assignment of a pointer that is not used, probable bug
@ 2021-12-11 18:19 Colin King (gmail)
2021-12-12 9:00 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Colin King (gmail) @ 2021-12-11 18:19 UTC (permalink / raw)
To: Jaroslav Kysela, Takashi Iwai, alsa-devel
Cc: Pierre-Louis Bossart, linux-kernel
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.
Coln
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ALSA: drivers: opl3: assignment of a pointer that is not used, probable bug
2021-12-11 18:19 ALSA: drivers: opl3: assignment of a pointer that is not used, probable bug Colin King (gmail)
@ 2021-12-12 9:00 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-12-12 9:00 UTC (permalink / raw)
To: Colin King (gmail)
Cc: Pierre-Louis Bossart, alsa-devel, Takashi Iwai, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-12 9:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-11 18:19 ALSA: drivers: opl3: assignment of a pointer that is not used, probable bug Colin King (gmail)
2021-12-12 9:00 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).