* [bug report] ASoC: codecs: pcm6240: Use guard() for mutex locks
@ 2026-09-14 10:08 Dan Carpenter
2026-09-15 11:08 ` Bui Duc Phuc
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2026-09-14 10:08 UTC (permalink / raw)
To: bui duc phuc; +Cc: linux-sound
Hello bui duc phuc,
Commit f3da3b7f6ed2 ("ASoC: codecs: pcm6240: Use guard() for mutex
locks") from Jul 21, 2026 (linux-next), leads to the following Smatch
static checker warning:
sound/soc/codecs/pcm6240.c:623 pcmdev_get_volsw()
warn: missing error code? 'ret'
sound/soc/codecs/pcm6240.c
594 static int pcmdev_get_volsw(struct snd_kcontrol *kcontrol,
595 struct snd_ctl_elem_value *ucontrol, int vol_ctrl_type)
596 {
597 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
598 struct pcmdevice_priv *pcm_dev =
599 snd_soc_component_get_drvdata(component);
600 struct pcmdevice_mixer_control *mc =
601 (struct pcmdevice_mixer_control *)kcontrol->private_value;
602 int max = mc->max, ret;
603 unsigned int mask = BIT(fls(max)) - 1;
604 unsigned int dev_no = mc->dev_no;
605 unsigned int shift = mc->shift;
606 unsigned int reg = mc->reg;
607 unsigned int val;
608
609 guard(mutex)(&pcm_dev->codec_lock);
610
611 if (pcm_dev->chip_id == PCM1690) {
612 ret = pcmdev_dev_read(pcm_dev, dev_no, PCM1690_REG_MODE_CTRL,
613 &val);
614 if (ret) {
615 dev_err(pcm_dev->dev, "%s: read mode err=%d\n",
616 __func__, ret);
617 return ret;
618 }
619 val &= PCM1690_REG_MODE_CTRL_DAMS_MSK;
620 /* Set to wide-range mode, before using vol ctrl. */
621 if (!val && vol_ctrl_type == PCMDEV_PCM1690_VOL_CTRL) {
622 ucontrol->value.integer.value[0] = -25500;
--> 623 return ret;
This was intentional, but it would be better to "return 0;" here.
624 }
625 /* Set to fine mode, before using fine vol ctrl. */
626 if (val && vol_ctrl_type == PCMDEV_PCM1690_FINE_VOL_CTRL) {
627 ucontrol->value.integer.value[0] = -12750;
628 return ret;
Same here.
629 }
630 }
631
632 ret = pcmdev_dev_read(pcm_dev, dev_no, reg, &val);
633 if (ret) {
634 dev_err(pcm_dev->dev, "%s: read err=%d\n",
635 __func__, ret);
636 return ret;
637 }
638
639 val = (val >> shift) & mask;
640 val = (val > max) ? max : val;
641 val = mc->invert ? max - val : val;
642 ucontrol->value.integer.value[0] = val;
643
644 return ret;
And here.
645 }
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] ASoC: codecs: pcm6240: Use guard() for mutex locks
2026-09-14 10:08 [bug report] ASoC: codecs: pcm6240: Use guard() for mutex locks Dan Carpenter
@ 2026-09-15 11:08 ` Bui Duc Phuc
0 siblings, 0 replies; 2+ messages in thread
From: Bui Duc Phuc @ 2026-09-15 11:08 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-sound
Hi Dan,
Thanks for the report.
> 622 ucontrol->value.integer.value[0] = -25500;
> --> 623 return ret;
>
> This was intentional, but it would be better to "return 0;" here.
>
I'll send a patch to fix this.
Best regards,
Phuc
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-15 11:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 10:08 [bug report] ASoC: codecs: pcm6240: Use guard() for mutex locks Dan Carpenter
2026-09-15 11:08 ` Bui Duc Phuc
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.