[PATCH 0/2] ASoC: cppcheck fixups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mark
Cc Takashi

This patch-set fixes the issues which is reported by cppcheck.

 sound/pci/asihpi/hpi6205.c   | 2 +-
 sound/pci/hda/patch_ca0132.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

It still reports about sound/pci/ice1712/wm8766.c (A)
that there is a case that "val2" might be used with uninitialized.
But I'm not sure what is the good solution for it.
So, I can do is only

Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>

	static int snd_wm8766_ctl_get(struct snd_kcontrol *kcontrol,
					  struct snd_ctl_elem_value *ucontrol)
	{
		struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol);
		int n = kcontrol->private_value;
		u16 val1, val2;

		if (wm->ctl[n].get)
			wm->ctl[n].get(wm, &val1, &val2);
		else {
			val1 = wm->regs[wm->ctl[n].reg1] & wm->ctl[n].mask1;
			val1 >>= __ffs(wm->ctl[n].mask1);
			if (wm->ctl[n].flags & WM8766_FLAG_STEREO) {
				val2 = wm->regs[wm->ctl[n].reg2] & wm->ctl[n].mask2;
				val2 >>= __ffs(wm->ctl[n].mask2);
				if (wm->ctl[n].flags & WM8766_FLAG_VOL_UPDATE)
					val2 &= ~WM8766_VOL_UPDATE;
			}
		}
		if (wm->ctl[n].flags & WM8766_FLAG_INVERT) {
			val1 = wm->ctl[n].max - (val1 - wm->ctl[n].min);
			if (wm->ctl[n].flags & WM8766_FLAG_STEREO)
(A)				val2 = wm->ctl[n].max - (val2 - wm->ctl[n].min);
		}                                        ^^^^
		ucontrol->value.integer.value[0] = val1;
		if (wm->ctl[n].flags & WM8766_FLAG_STEREO)
			ucontrol->value.integer.value[1] = val2;

		return 0;
	}


--
2.25.1




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux