lkml.org 
[lkml]   [2017]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Staging: comedi: das16: Fixed a const struct coding style issue
Hi Alex,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.15-rc1 next-20171127]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Alex-Frappier-Lachapelle/Staging-comedi-das16-Fixed-a-const-struct-coding-style-issue/20171128-090836
config: x86_64-randconfig-x004-201748 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

drivers/staging//comedi/drivers/das16.c: In function 'das16_ai_range':
>> drivers/staging//comedi/drivers/das16.c:980:18: error: assignment of member 'length' in read-only object
lrange->length = 1;
^
>> drivers/staging//comedi/drivers/das16.c:981:10: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
krange = lrange->range;
^
drivers/staging//comedi/drivers/das16.c: In function 'das16_ao_range':
drivers/staging//comedi/drivers/das16.c:1014:18: error: assignment of member 'length' in read-only object
lrange->length = 1;
^
drivers/staging//comedi/drivers/das16.c:1015:10: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
krange = lrange->range;
^

vim +/length +980 drivers/staging//comedi/drivers/das16.c

742c4a09 H Hartley Sweeten 2015-01-12 958
0ce8280e H Hartley Sweeten 2015-01-26 959 static const struct comedi_lrange *das16_ai_range(struct comedi_device *dev,
0ce8280e H Hartley Sweeten 2015-01-26 960 struct comedi_subdevice *s,
0ce8280e H Hartley Sweeten 2015-01-26 961 struct comedi_devconfig *it,
0ce8280e H Hartley Sweeten 2015-01-26 962 unsigned int pg_type,
0ce8280e H Hartley Sweeten 2015-01-26 963 unsigned int status)
0ce8280e H Hartley Sweeten 2015-01-26 964 {
0ce8280e H Hartley Sweeten 2015-01-26 965 unsigned int min = it->options[4];
0ce8280e H Hartley Sweeten 2015-01-26 966 unsigned int max = it->options[5];
0ce8280e H Hartley Sweeten 2015-01-26 967
0ce8280e H Hartley Sweeten 2015-01-26 968 /* get any user-defined input range */
0ce8280e H Hartley Sweeten 2015-01-26 969 if (pg_type == das16_pg_none && (min || max)) {
680d002a Alex Frappier Lachapelle 2017-11-25 970 const struct comedi_lrange *lrange;
0ce8280e H Hartley Sweeten 2015-01-26 971 struct comedi_krange *krange;
0ce8280e H Hartley Sweeten 2015-01-26 972
0ce8280e H Hartley Sweeten 2015-01-26 973 /* allocate single-range range table */
0ce8280e H Hartley Sweeten 2015-01-26 974 lrange = comedi_alloc_spriv(s,
0ce8280e H Hartley Sweeten 2015-01-26 975 sizeof(*lrange) + sizeof(*krange));
0ce8280e H Hartley Sweeten 2015-01-26 976 if (!lrange)
0ce8280e H Hartley Sweeten 2015-01-26 977 return &range_unknown;
0ce8280e H Hartley Sweeten 2015-01-26 978
0ce8280e H Hartley Sweeten 2015-01-26 979 /* initialize ai range */
0ce8280e H Hartley Sweeten 2015-01-26 @980 lrange->length = 1;
0ce8280e H Hartley Sweeten 2015-01-26 @981 krange = lrange->range;
0ce8280e H Hartley Sweeten 2015-01-26 982 krange->min = min;
0ce8280e H Hartley Sweeten 2015-01-26 983 krange->max = max;
0ce8280e H Hartley Sweeten 2015-01-26 984 krange->flags = UNIT_volt;
0ce8280e H Hartley Sweeten 2015-01-26 985
0ce8280e H Hartley Sweeten 2015-01-26 986 return lrange;
0ce8280e H Hartley Sweeten 2015-01-26 987 }
0ce8280e H Hartley Sweeten 2015-01-26 988
0ce8280e H Hartley Sweeten 2015-01-26 989 /* use software programmable range */
0ce8280e H Hartley Sweeten 2015-01-26 990 if (status & DAS16_STATUS_UNIPOLAR)
0ce8280e H Hartley Sweeten 2015-01-26 991 return das16_ai_uni_lranges[pg_type];
0ce8280e H Hartley Sweeten 2015-01-26 992 return das16_ai_bip_lranges[pg_type];
0ce8280e H Hartley Sweeten 2015-01-26 993 }
0ce8280e H Hartley Sweeten 2015-01-26 994

:::::: The code at line 980 was first introduced by commit
:::::: 0ce8280e2876091b5c67cb515fae8e9bf3b50bfd staging: comedi: das16: introduce das16_ai_range()

:::::: TO: H Hartley Sweeten <hsweeten@visionengravers.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2017-11-28 03:39    [W:0.065 / U:10.516 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site