tree:
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git queue-5.4
head: d2c5af89e80c5b71f1da59879464a930947306a2
commit: 713f282ba1b735b09b6af98f17f466cbc515b5a6 [111/132] ALSA: usb-audio: Drop bogus dB
range in too low level
config: x86_64-randconfig-a001-20210318 (attached as .config)
compiler: clang version 13.0.0 (
https://github.com/llvm/llvm-project
436c6c9c20cc522c92a923440a5fc509c342a7db)
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
#
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git/c...
git remote add sashal-linux-stable
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
git fetch --no-tags sashal-linux-stable queue-5.4
git checkout 713f282ba1b735b09b6af98f17f466cbc515b5a6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
> sound/usb/mixer.c:1300:27: error: implicit declaration of
function 'mixer_ctrl_intf' [-Werror,-Wimplicit-function-declaration]
cval->head.id, mixer_ctrl_intf(cval->head.mixer),
^
1 error generated.
vim +/mixer_ctrl_intf +1300 sound/usb/mixer.c
1186
1187 /*
1188 * retrieve the minimum and maximum values for the specified control
1189 */
1190 static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
1191 int default_min, struct snd_kcontrol *kctl)
1192 {
1193 /* for failsafe */
1194 cval->min = default_min;
1195 cval->max = cval->min + 1;
1196 cval->res = 1;
1197 cval->dBmin = cval->dBmax = 0;
1198
1199 if (cval->val_type == USB_MIXER_BOOLEAN ||
1200 cval->val_type == USB_MIXER_INV_BOOLEAN) {
1201 cval->initialized = 1;
1202 } else {
1203 int minchn = 0;
1204 if (cval->cmask) {
1205 int i;
1206 for (i = 0; i < MAX_CHANNELS; i++)
1207 if (cval->cmask & (1 << i)) {
1208 minchn = i + 1;
1209 break;
1210 }
1211 }
1212 if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn,
&cval->max) < 0 ||
1213 get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn,
&cval->min) < 0) {
1214 usb_audio_err(cval->head.mixer->chip,
1215 "%d:%d: cannot get min/max values for control %d (id %d)\n",
1216 cval->head.id, snd_usb_ctrl_intf(cval->head.mixer->chip),
1217 cval->control, cval->head.id);
1218 return -EINVAL;
1219 }
1220 if (get_ctl_value(cval, UAC_GET_RES,
1221 (cval->control << 8) | minchn,
1222 &cval->res) < 0) {
1223 cval->res = 1;
1224 } else {
1225 int last_valid_res = cval->res;
1226
1227 while (cval->res > 1) {
1228 if (snd_usb_mixer_set_ctl_value(cval, UAC_SET_RES,
1229 (cval->control << 8) | minchn,
1230 cval->res / 2) < 0)
1231 break;
1232 cval->res /= 2;
1233 }
1234 if (get_ctl_value(cval, UAC_GET_RES,
1235 (cval->control << 8) | minchn, &cval->res) < 0)
1236 cval->res = last_valid_res;
1237 }
1238 if (cval->res == 0)
1239 cval->res = 1;
1240
1241 /* Additional checks for the proper resolution
1242 *
1243 * Some devices report smaller resolutions than actually
1244 * reacting. They don't return errors but simply clip
1245 * to the lower aligned value.
1246 */
1247 if (cval->min + cval->res < cval->max) {
1248 int last_valid_res = cval->res;
1249 int saved, test, check;
1250 if (get_cur_mix_raw(cval, minchn, &saved) < 0)
1251 goto no_res_check;
1252 for (;;) {
1253 test = saved;
1254 if (test < cval->max)
1255 test += cval->res;
1256 else
1257 test -= cval->res;
1258 if (test < cval->min || test > cval->max ||
1259 snd_usb_set_cur_mix_value(cval, minchn, 0, test) ||
1260 get_cur_mix_raw(cval, minchn, &check)) {
1261 cval->res = last_valid_res;
1262 break;
1263 }
1264 if (test == check)
1265 break;
1266 cval->res *= 2;
1267 }
1268 snd_usb_set_cur_mix_value(cval, minchn, 0, saved);
1269 }
1270
1271 no_res_check:
1272 cval->initialized = 1;
1273 }
1274
1275 if (kctl)
1276 volume_control_quirks(cval, kctl);
1277
1278 /* USB descriptions contain the dB scale in 1/256 dB unit
1279 * while ALSA TLV contains in 1/100 dB unit
1280 */
1281 cval->dBmin = (convert_signed_value(cval, cval->min) * 100) / 256;
1282 cval->dBmax = (convert_signed_value(cval, cval->max) * 100) / 256;
1283 if (cval->dBmin > cval->dBmax) {
1284 /* something is wrong; assume it's either from/to 0dB */
1285 if (cval->dBmin < 0)
1286 cval->dBmax = 0;
1287 else if (cval->dBmin > 0)
1288 cval->dBmin = 0;
1289 if (cval->dBmin > cval->dBmax) {
1290 /* totally crap, return an error */
1291 return -EINVAL;
1292 }
1293 } else {
1294 /* if the max volume is too low, it's likely a bogus range;
1295 * here we use -96dB as the threshold
1296 */
1297 if (cval->dBmax <= -9600) {
1298 usb_audio_info(cval->head.mixer->chip,
1299 "%d:%d: bogus dB values (%d/%d), disabling dB reporting\n",
1300 cval->head.id,
mixer_ctrl_intf(cval->head.mixer),
1301 cval->dBmin,
cval->dBmax);
1302 cval->dBmin = cval->dBmax = 0;
1303 }
1304 }
1305
1306 return 0;
1307 }
1308
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org