All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Rong Zhang <i@rong.moe>
Cc: linux-sound@vger.kernel.org
Subject: [bug report] ALSA: usb-audio: Add error checks against get_min_max*()
Date: Tue, 14 Apr 2026 11:27:32 +0300	[thread overview]
Message-ID: <ad36dGpCBTGsyFr_@stanley.mountain> (raw)

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.

    2691                         }
    2692 
    2693                         err = get_min_max(cval, valinfo->min_value);
    2694                         break;
    2695                 }
    2696                 case USB_XU_CLOCK_RATE:
    2697                         /*
    2698                          * E-Mu USB 0404/0202/TrackerPre/0204
    2699                          * samplerate control quirk
    2700                          */
    2701                         cval->min = 0;
    2702                         cval->max = 5;
    2703                         cval->res = 1;
    2704                         cval->initialized = 1;
    2705                         err = 0;
    2706                         break;
    2707                 default:
    2708                         err = get_min_max(cval, valinfo->min_value);
    2709                         break;
    2710                 }
--> 2711                 if (err < 0 && err != -EAGAIN) {
    2712                         usb_mixer_elem_info_free(cval);
    2713                         return err;
    2714                 }
    2715 
    2716                 err = get_cur_ctl_value(cval, cval->control << 8, &val);
    2717                 if (err < 0) {
    2718                         usb_mixer_elem_info_free(cval);
    2719                         return -EINVAL;
    2720                 }
    2721 
    
This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

             reply	other threads:[~2026-04-14  8:27 UTC|newest]

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

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=ad36dGpCBTGsyFr_@stanley.mountain \
    --to=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 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.