Re: [PATCH v1 1/4] platform/x86: intel_pmc_core: fix: Make pmc_core_lpm_display() generic for platforms that support sub-states

From: kbuild test robot
Date: Thu Feb 27 2020 - 01:29:03 EST


Hi Gayatri,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on platform-drivers-x86/for-next]
[also build test WARNING on next-20200226]
[cannot apply to tip/auto-latest linux/master linus/master v5.6-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Gayatri-Kammela/platform-x86-intel_pmc_core-Add-bug-fixes-or-code/20200227-105701
base: git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git for-next
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/platform/x86/intel_pmc_core.c: In function 'pmc_core_lpm_display':
>> drivers/platform/x86/intel_pmc_core.c:987:2: warning: ISO C90 forbids variable length array 'lpm_regs' [-Wvla]
u32 lpm_regs[arr_size];
^~~
>> drivers/platform/x86/intel_pmc_core.c:987:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

vim +/lpm_regs +987 drivers/platform/x86/intel_pmc_core.c

976
977 static void pmc_core_lpm_display(struct pmc_dev *pmcdev, struct device *dev,
978 struct seq_file *s, u32 offset,
979 const char *str,
980 const struct pmc_bit_map **maps)
981 {
982 int index, idx, len = 32, bit_mask, arr_size = 0;
983
984 for (index = 0; maps[index]; index++)
985 arr_size++;
986
> 987 u32 lpm_regs[arr_size];
988
989 for (index = 0; maps[index]; index++) {
990 lpm_regs[index] = pmc_core_reg_read(pmcdev, offset);
991 offset += 4;
992 }
993
994 for (idx = 0; maps[idx]; idx++) {
995 if (dev)
996 dev_dbg(dev, "\nLPM_%s_%d:\t0x%x\n", str, idx,
997 lpm_regs[idx]);
998 if (s)
999 seq_printf(s, "\nLPM_%s_%d:\t0x%x\n", str, idx,
1000 lpm_regs[idx]);
1001 for (index = 0; maps[idx][index].name && index < len; index++) {
1002 bit_mask = maps[idx][index].bit_mask;
1003 if (dev)
1004 dev_dbg(dev, "%-30s %-30d\n",
1005 maps[idx][index].name,
1006 lpm_regs[idx] & bit_mask ? 1 : 0);
1007 if (s)
1008 seq_printf(s, "%-30s %-30d\n",
1009 maps[idx][index].name,
1010 lpm_regs[idx] & bit_mask ? 1 : 0);
1011 }
1012 }
1013 }
1014

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip