Hello Vaibhav Agarwal,
The patch 6339d2322c47: "greybus: audio: Add topology parser for GB
codec" from Jan 13, 2016, leads to the following static checker
warning:
drivers/staging/greybus/audio_topology.c:374
gbcodec_mixer_dapm_ctl_info()
warn: unsigned 'info->value.integer.min' is never less than zero.
drivers/staging/greybus/audio_topology.c
348 static int gbcodec_mixer_dapm_ctl_info(struct snd_kcontrol *kcontrol,
349 struct snd_ctl_elem_info *uinfo)
350 {
351 int platform_max, platform_min;
352 struct gbaudio_ctl_pvt *data;
353 struct gb_audio_ctl_elem_info *info;
354 struct snd_soc_dapm_widget_list *wlist =
snd_kcontrol_chip(kcontrol);
355 struct snd_soc_dapm_widget *widget = wlist->widgets[0];
356 struct snd_soc_codec *codec = widget->codec;
357
358 dev_dbg(codec->dev, "Entered %s:%s\n", __func__,
kcontrol->id.name);
359 data = (struct gbaudio_ctl_pvt *)kcontrol->private_value;
360 info = (struct gb_audio_ctl_elem_info *)data->info;
361
362 /* update uinfo */
363 platform_max = info->value.integer.max;
364 platform_min = info->value.integer.min;
365
366 if (platform_max == 1 &&
367 !strnstr(kcontrol->id.name, " Volume", NAME_SIZE))
368 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
369 else
370 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
371
372 uinfo->count = data->vcount;
373 uinfo->value.integer.min = 0;
374 if (info->value.integer.min < 0 &&
^^^^^^^^^^^^^^^^^^^^^
You probably assumed that because the name says "integer" that means it
is an integer. Surprise!!! NOPE! It's an __le32.
375 (uinfo->type == SNDRV_CTL_ELEM_TYPE_INTEGER))
376 uinfo->value.integer.max = platform_max - platform_min;
377 else
378 uinfo->value.integer.max = platform_max;
379
380 return 0;
381 }
regards,
dan carpenter
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel