Skip to contentSkip to conversation

ALSA: usb-audio: Scarlett Gen 2 mixer interface

bug report Dan Carpenter 1 participant 1 message Sep 12 Sound

lore
Share & tools
lore
#0 lore raw

Hello Geoffrey D. Bennett,

Commit 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface") from Jul 29, 2019 (linux-next), leads to the following Smatch static checker warning:

	sound/usb/mixer_scarlett2.c:4605 scarlett2_update_volumes()
	warn: always clamps to 127

sound/usb/mixer_scarlett2.c

    4589 static int scarlett2_update_volumes(struct usb_mixer_interface *mixer)
    4590 {
    4591         struct scarlett2_data *private = mixer->private_data;
    4592         s16 vol;
    4593         int err, i;
    4594 
    4595         private->vol_updated = 0;
    4596 
    4597         if (scarlett2_has_config_item(private,
    4598                                       SCARLETT2_CONFIG_MASTER_VOLUME)) {
    4599                 err = scarlett2_usb_get_config(
    4600                         mixer, SCARLETT2_CONFIG_MASTER_VOLUME,
    4601                         1, &vol);
    4602                 if (err < 0)
    4603                         return err;
    4604 
--> 4605                 private->master_vol = clamp(vol + SCARLETT2_VOLUME_BIAS,
    4606                                             0, SCARLETT2_VOLUME_BIAS);

This clamp() is equivalent to "private->master_vol = SCARLETT2_VOLUME_BIAS;" It's unclear what it's supposed to do.

4607
4608 if (scarlett2_has_config_item(private,
4609 SCARLETT2_CONFIG_SW_HW_SWITCH))

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter