public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <error27@gmail.com>
Cc: Rong Zhang <i@rong.moe>, linux-sound@vger.kernel.org
Subject: Re: [bug report] ALSA: usb-audio: Add error checks against get_min_max*()
Date: Tue, 14 Apr 2026 11:24:45 +0200	[thread overview]
Message-ID: <87o6jlsxlu.wl-tiwai@suse.de> (raw)
In-Reply-To: <ad36dGpCBTGsyFr_@stanley.mountain>

On Tue, 14 Apr 2026 10:27:32 +0200,
Dan Carpenter wrote:
> 
> Hello Rong Zhang,
> 
> Commit 4f55a85cd4fc ("ALSA: usb-audio: Add error checks against
> get_min_max*()") from Apr 11, 2026 (linux-next), leads to the
> following Smatch static checker warning:
> 
> 	sound/usb/mixer.c:2711 build_audio_procunit()
> 	error: uninitialized symbol 'err'.
> 
> sound/usb/mixer.c
>     2660                 if (state->mixer->protocol > UAC_VERSION_1 &&
>     2661                     !uac_v2v3_control_is_writeable(controls[valinfo->control / 8],
>     2662                                                    valinfo->control))
>     2663                         cval->master_readonly = 1;
>     2664 
>     2665                 /* get min/max values */
>     2666                 switch (type) {
>     2667                 case UAC_PROCESS_UP_DOWNMIX: {
>     2668                         bool mode_sel = false;
>     2669 
>     2670                         switch (state->mixer->protocol) {
>     2671                         case UAC_VERSION_1:
>     2672                         case UAC_VERSION_2:
>     2673                         default:
>     2674                                 if (cval->control == UAC_UD_MODE_SELECT)
>     2675                                         mode_sel = true;
>     2676                                 break;
>     2677                         case UAC_VERSION_3:
>     2678                                 if (cval->control == UAC3_UD_MODE_SELECT)
>     2679                                         mode_sel = true;
>     2680                                 break;
>     2681                         }
>     2682 
>     2683                         if (mode_sel) {
>     2684                                 __u8 *control_spec = uac_processing_unit_specific(desc,
>     2685                                                                 state->mixer->protocol);
>     2686                                 cval->min = 1;
>     2687                                 cval->max = control_spec[0];
>     2688                                 cval->res = 1;
>     2689                                 cval->initialized = 1;
>     2690                                 break;
> 
> err not initialized at this break.

Thanks for the report.  Let's plug the hole with a simple fix to add
"err = 0" here.

I'm going to submit a fix patch.


Takashi

      reply	other threads:[~2026-04-14  9:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14  8:27 [bug report] ALSA: usb-audio: Add error checks against get_min_max*() Dan Carpenter
2026-04-14  9:24 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o6jlsxlu.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=error27@gmail.com \
    --cc=i@rong.moe \
    --cc=linux-sound@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox