Re: [PATCH] staging: comedi: remove warnings of comedi_lrange
From: kernel test robot
Date: Mon Dec 28 2020 - 23:02:05 EST
Hi chensong,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/0day-ci/linux/commits/chensong/staging-comedi-remove-warnings-of-comedi_lrange/20201223-104542
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 5e60366d56c630e32befce7ef05c569e04391ca3
config: x86_64-randconfig-r012-20201223 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
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://github.com/0day-ci/linux/commit/fec78f1f56c0e63e9240b5b30c3b98d29ecc9a49
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review chensong/staging-comedi-remove-warnings-of-comedi_lrange/20201223-104542
git checkout fec78f1f56c0e63e9240b5b30c3b98d29ecc9a49
# 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@xxxxxxxxx>
All errors (new ones prefixed by >>):
>> drivers/staging/comedi/drivers/das16.c:971:18: error: cannot assign to variable 'lrange' with const-qualified type 'const struct comedi_lrange *'
lrange->length = 1;
~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/das16.c:961:31: note: variable 'lrange' declared const here
const struct comedi_lrange *lrange;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
>> drivers/staging/comedi/drivers/das16.c:972:10: error: assigning to 'struct comedi_krange *' from 'struct comedi_krange const[]' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
krange = lrange->range;
^ ~~~~~~~~~~~~~
drivers/staging/comedi/drivers/das16.c:1005:18: error: cannot assign to variable 'lrange' with const-qualified type 'const struct comedi_lrange *'
lrange->length = 1;
~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/das16.c:995:31: note: variable 'lrange' declared const here
const struct comedi_lrange *lrange;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
drivers/staging/comedi/drivers/das16.c:1006:10: error: assigning to 'struct comedi_krange *' from 'struct comedi_krange const[]' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
krange = lrange->range;
^ ~~~~~~~~~~~~~
4 errors generated.
--
>> drivers/staging/comedi/drivers/jr3_pci.c:527:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[0].l.range[0].min = -get_s16(&fs->fx) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:528:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[0].l.range[0].max = get_s16(&fs->fx) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:529:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[1].l.range[0].min = -get_s16(&fs->fy) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:530:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[1].l.range[0].max = get_s16(&fs->fy) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:531:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[2].l.range[0].min = -get_s16(&fs->fz) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:532:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[2].l.range[0].max = get_s16(&fs->fz) * 1000;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:533:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[3].l.range[0].min = -get_s16(&fs->mx) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:534:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[3].l.range[0].max = get_s16(&fs->mx) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:535:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[4].l.range[0].min = -get_s16(&fs->my) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:536:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[4].l.range[0].max = get_s16(&fs->my) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:537:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[5].l.range[0].min = -get_s16(&fs->mz) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:539:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[5].l.range[0].max = get_s16(&fs->mz) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:540:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[6].l.range[0].min = -get_s16(&fs->v1) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:541:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[6].l.range[0].max = get_s16(&fs->v1) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:542:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[7].l.range[0].min = -get_s16(&fs->v2) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:543:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[7].l.range[0].max = get_s16(&fs->v2) * 100;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
drivers/staging/comedi/drivers/jr3_pci.c:544:24: error: cannot assign to non-static data member 'l' with const-qualified type 'const struct comedi_lrange'
r[8].l.range[0].min = 0;
~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/comedi/drivers/jr3_pci.c:94:29: note: non-static data member 'l' declared const here
const struct comedi_lrange l;
vim +971 drivers/staging/comedi/drivers/das16.c
742c4a095973f69 H Hartley Sweeten 2015-01-12 949
0ce8280e2876091 H Hartley Sweeten 2015-01-26 950 static const struct comedi_lrange *das16_ai_range(struct comedi_device *dev,
0ce8280e2876091 H Hartley Sweeten 2015-01-26 951 struct comedi_subdevice *s,
0ce8280e2876091 H Hartley Sweeten 2015-01-26 952 struct comedi_devconfig *it,
0ce8280e2876091 H Hartley Sweeten 2015-01-26 953 unsigned int pg_type,
0ce8280e2876091 H Hartley Sweeten 2015-01-26 954 unsigned int status)
0ce8280e2876091 H Hartley Sweeten 2015-01-26 955 {
0ce8280e2876091 H Hartley Sweeten 2015-01-26 956 unsigned int min = it->options[4];
0ce8280e2876091 H Hartley Sweeten 2015-01-26 957 unsigned int max = it->options[5];
0ce8280e2876091 H Hartley Sweeten 2015-01-26 958
0ce8280e2876091 H Hartley Sweeten 2015-01-26 959 /* get any user-defined input range */
0ce8280e2876091 H Hartley Sweeten 2015-01-26 960 if (pg_type == das16_pg_none && (min || max)) {
fec78f1f56c0e63 chensong 2020-12-23 961 const struct comedi_lrange *lrange;
0ce8280e2876091 H Hartley Sweeten 2015-01-26 962 struct comedi_krange *krange;
0ce8280e2876091 H Hartley Sweeten 2015-01-26 963
0ce8280e2876091 H Hartley Sweeten 2015-01-26 964 /* allocate single-range range table */
0ce8280e2876091 H Hartley Sweeten 2015-01-26 965 lrange = comedi_alloc_spriv(s,
0ce8280e2876091 H Hartley Sweeten 2015-01-26 966 sizeof(*lrange) + sizeof(*krange));
0ce8280e2876091 H Hartley Sweeten 2015-01-26 967 if (!lrange)
0ce8280e2876091 H Hartley Sweeten 2015-01-26 968 return &range_unknown;
0ce8280e2876091 H Hartley Sweeten 2015-01-26 969
0ce8280e2876091 H Hartley Sweeten 2015-01-26 970 /* initialize ai range */
0ce8280e2876091 H Hartley Sweeten 2015-01-26 @971 lrange->length = 1;
0ce8280e2876091 H Hartley Sweeten 2015-01-26 @972 krange = lrange->range;
0ce8280e2876091 H Hartley Sweeten 2015-01-26 973 krange->min = min;
0ce8280e2876091 H Hartley Sweeten 2015-01-26 974 krange->max = max;
0ce8280e2876091 H Hartley Sweeten 2015-01-26 975 krange->flags = UNIT_volt;
0ce8280e2876091 H Hartley Sweeten 2015-01-26 976
0ce8280e2876091 H Hartley Sweeten 2015-01-26 977 return lrange;
0ce8280e2876091 H Hartley Sweeten 2015-01-26 978 }
0ce8280e2876091 H Hartley Sweeten 2015-01-26 979
0ce8280e2876091 H Hartley Sweeten 2015-01-26 980 /* use software programmable range */
0ce8280e2876091 H Hartley Sweeten 2015-01-26 981 if (status & DAS16_STATUS_UNIPOLAR)
0ce8280e2876091 H Hartley Sweeten 2015-01-26 982 return das16_ai_uni_lranges[pg_type];
0ce8280e2876091 H Hartley Sweeten 2015-01-26 983 return das16_ai_bip_lranges[pg_type];
0ce8280e2876091 H Hartley Sweeten 2015-01-26 984 }
0ce8280e2876091 H Hartley Sweeten 2015-01-26 985
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip