Re: [PATCH] staging: comedi: remove warnings of comedi_lrange
From: kernel test robot
Date: Mon Dec 28 2020 - 22:51:07 EST
Hi chensong,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING 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: nios2-allyesconfig (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
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
# 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=gcc-9.3.0 make.cross ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
drivers/staging/comedi/drivers/das16.c: In function 'das16_ai_range':
drivers/staging/comedi/drivers/das16.c:971:18: error: assignment of member 'length' in read-only object
971 | lrange->length = 1;
| ^
>> drivers/staging/comedi/drivers/das16.c:972:10: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
972 | krange = lrange->range;
| ^
drivers/staging/comedi/drivers/das16.c: In function 'das16_ao_range':
drivers/staging/comedi/drivers/das16.c:1005:18: error: assignment of member 'length' in read-only object
1005 | lrange->length = 1;
| ^
drivers/staging/comedi/drivers/das16.c:1006:10: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
1006 | krange = lrange->range;
| ^
vim +/const +972 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