sound/soc/codecs/wm8962.c:2790:32: warning: 'fratio' may be used uninitialized in this function

From: kbuild test robot
Date: Mon Jan 25 2016 - 02:17:00 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 92e963f50fc74041b5e9e744c330dca48e04f08d
commit: c6d308534aef6c99904bf5862066360ae067abc4 UBSAN: run-time undefined behavior sanity checker
date: 4 days ago
config: x86_64-randconfig-n0-01251456 (attached as .config)
reproduce:
git checkout c6d308534aef6c99904bf5862066360ae067abc4
# save the attached .config to linux build tree
make ARCH=x86_64

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

sound/soc/codecs/wm8962.c: In function 'wm8962_set_fll':
>> sound/soc/codecs/wm8962.c:2790:32: warning: 'fratio' may be used uninitialized in this function [-Wmaybe-uninitialized]
fll_div->n = target / (fratio * Fref);
^
sound/soc/codecs/wm8962.c:2740:15: note: 'fratio' was declared here
unsigned int fratio, gcd_fll;
^

vim +/fratio +2790 sound/soc/codecs/wm8962.c

9a76f1ff Mark Brown 2010-08-05 2774
9a76f1ff Mark Brown 2010-08-05 2775 pr_debug("FLL Fvco=%dHz\n", target);
9a76f1ff Mark Brown 2010-08-05 2776
25985edc Lucas De Marchi 2011-03-30 2777 /* Find an appropriate FLL_FRATIO and factor it out of the target */
9a76f1ff Mark Brown 2010-08-05 2778 for (i = 0; i < ARRAY_SIZE(fll_fratios); i++) {
9a76f1ff Mark Brown 2010-08-05 2779 if (fll_fratios[i].min <= Fref && Fref <= fll_fratios[i].max) {
9a76f1ff Mark Brown 2010-08-05 2780 fll_div->fll_fratio = fll_fratios[i].fll_fratio;
9a76f1ff Mark Brown 2010-08-05 2781 fratio = fll_fratios[i].ratio;
9a76f1ff Mark Brown 2010-08-05 2782 break;
9a76f1ff Mark Brown 2010-08-05 2783 }
9a76f1ff Mark Brown 2010-08-05 2784 }
9a76f1ff Mark Brown 2010-08-05 2785 if (i == ARRAY_SIZE(fll_fratios)) {
9a76f1ff Mark Brown 2010-08-05 2786 pr_err("Unable to find FLL_FRATIO for Fref=%uHz\n", Fref);
9a76f1ff Mark Brown 2010-08-05 2787 return -EINVAL;
9a76f1ff Mark Brown 2010-08-05 2788 }
9a76f1ff Mark Brown 2010-08-05 2789
9a76f1ff Mark Brown 2010-08-05 @2790 fll_div->n = target / (fratio * Fref);
9a76f1ff Mark Brown 2010-08-05 2791
9a76f1ff Mark Brown 2010-08-05 2792 if (target % Fref == 0) {
9a76f1ff Mark Brown 2010-08-05 2793 fll_div->theta = 0;
9a76f1ff Mark Brown 2010-08-05 2794 fll_div->lambda = 0;
9a76f1ff Mark Brown 2010-08-05 2795 } else {
9a76f1ff Mark Brown 2010-08-05 2796 gcd_fll = gcd(target, fratio * Fref);
9a76f1ff Mark Brown 2010-08-05 2797
9a76f1ff Mark Brown 2010-08-05 2798 fll_div->theta = (target - (fll_div->n * fratio * Fref))

:::::: The code at line 2790 was first introduced by commit
:::::: 9a76f1ff6e299fbb04149fe15aff061351fd0dab ASoC: Add initial WM8962 CODEC driver

:::::: TO: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
:::::: CC: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: Binary data