drivers/staging/comedi/drivers/pcmad.c:61:18: sparse: sparse: cast removes address space '__iomem' of expression

From: kernel test robot
Date: Sat Aug 22 2020 - 14:25:26 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f873db9acd3c92d4741bc3676c9eb511b2f9a6f6
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 9 weeks ago
config: riscv-randconfig-s031-20200822 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-191-g10164920-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=riscv

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


sparse warnings: (new ones prefixed by >>)

>> drivers/staging/comedi/drivers/pcmad.c:61:18: sparse: sparse: cast removes address space '__iomem' of expression
>> drivers/staging/comedi/drivers/pcmad.c:61:18: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got void * @@
>> drivers/staging/comedi/drivers/pcmad.c:61:18: sparse: expected void const volatile [noderef] __iomem *addr
drivers/staging/comedi/drivers/pcmad.c:61:18: sparse: got void *
drivers/staging/comedi/drivers/pcmad.c:79:17: sparse: sparse: cast removes address space '__iomem' of expression
>> drivers/staging/comedi/drivers/pcmad.c:79:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
>> drivers/staging/comedi/drivers/pcmad.c:79:17: sparse: expected void volatile [noderef] __iomem *addr
drivers/staging/comedi/drivers/pcmad.c:79:17: sparse: got void *
drivers/staging/comedi/drivers/pcmad.c:85:23: sparse: sparse: cast removes address space '__iomem' of expression
drivers/staging/comedi/drivers/pcmad.c:85:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got void * @@
drivers/staging/comedi/drivers/pcmad.c:85:23: sparse: expected void const volatile [noderef] __iomem *addr
drivers/staging/comedi/drivers/pcmad.c:85:23: sparse: got void *
drivers/staging/comedi/drivers/pcmad.c:86:24: sparse: sparse: cast removes address space '__iomem' of expression
drivers/staging/comedi/drivers/pcmad.c:86:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got void * @@
drivers/staging/comedi/drivers/pcmad.c:86:24: sparse: expected void const volatile [noderef] __iomem *addr
drivers/staging/comedi/drivers/pcmad.c:86:24: sparse: got void *

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=670d0a4b10704667765f7d18f7592993d02783aa
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
vim +/__iomem +61 drivers/staging/comedi/drivers/pcmad.c

2a09cba62e82eb H Hartley Sweeten 2013-06-05 53
42946cfc55f5cf H Hartley Sweeten 2014-02-10 54 static int pcmad_ai_eoc(struct comedi_device *dev,
42946cfc55f5cf H Hartley Sweeten 2014-02-10 55 struct comedi_subdevice *s,
42946cfc55f5cf H Hartley Sweeten 2014-02-10 56 struct comedi_insn *insn,
42946cfc55f5cf H Hartley Sweeten 2014-02-10 57 unsigned long context)
bcc01b4d852c73 H Hartley Sweeten 2013-06-05 58 {
42946cfc55f5cf H Hartley Sweeten 2014-02-10 59 unsigned int status;
bcc01b4d852c73 H Hartley Sweeten 2013-06-05 60
42946cfc55f5cf H Hartley Sweeten 2014-02-10 @61 status = inb(dev->iobase + PCMAD_STATUS);
42946cfc55f5cf H Hartley Sweeten 2014-02-10 62 if ((status & 0x3) == 0x3)
bcc01b4d852c73 H Hartley Sweeten 2013-06-05 63 return 0;
42946cfc55f5cf H Hartley Sweeten 2014-02-10 64 return -EBUSY;
bcc01b4d852c73 H Hartley Sweeten 2013-06-05 65 }
bcc01b4d852c73 H Hartley Sweeten 2013-06-05 66
0a85b6f0ab0d2e Mithlesh Thukral 2009-06-08 67 static int pcmad_ai_insn_read(struct comedi_device *dev,
0a85b6f0ab0d2e Mithlesh Thukral 2009-06-08 68 struct comedi_subdevice *s,
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 69 struct comedi_insn *insn,
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 70 unsigned int *data)
58e732ee57eae8 David Schleef 2009-02-17 71 {
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 72 unsigned int chan = CR_CHAN(insn->chanspec);
7ecc5370de1562 H Hartley Sweeten 2013-06-05 73 unsigned int range = CR_RANGE(insn->chanspec);
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 74 unsigned int val;
bcc01b4d852c73 H Hartley Sweeten 2013-06-05 75 int ret;
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 76 int i;
58e732ee57eae8 David Schleef 2009-02-17 77
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 78 for (i = 0; i < insn->n; i++) {
58e732ee57eae8 David Schleef 2009-02-17 @79 outb(chan, dev->iobase + PCMAD_CONVERT);
58e732ee57eae8 David Schleef 2009-02-17 80
42946cfc55f5cf H Hartley Sweeten 2014-02-10 81 ret = comedi_timeout(dev, s, insn, pcmad_ai_eoc, 0);
bcc01b4d852c73 H Hartley Sweeten 2013-06-05 82 if (ret)
bcc01b4d852c73 H Hartley Sweeten 2013-06-05 83 return ret;
bcc01b4d852c73 H Hartley Sweeten 2013-06-05 84
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 85 val = inb(dev->iobase + PCMAD_LSB) |
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 86 (inb(dev->iobase + PCMAD_MSB) << 8);
58e732ee57eae8 David Schleef 2009-02-17 87
3170b2565fb2ef H Hartley Sweeten 2013-06-05 88 /* data is shifted on the pcmad12, fix it */
3170b2565fb2ef H Hartley Sweeten 2013-06-05 89 if (s->maxdata == 0x0fff)
3170b2565fb2ef H Hartley Sweeten 2013-06-05 90 val >>= 4;
3170b2565fb2ef H Hartley Sweeten 2013-06-05 91
43db70a50737d9 H Hartley Sweeten 2013-08-28 92 if (comedi_range_is_bipolar(s, range)) {
7ecc5370de1562 H Hartley Sweeten 2013-06-05 93 /* munge the two's complement value */
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 94 val ^= ((s->maxdata + 1) >> 1);
7ecc5370de1562 H Hartley Sweeten 2013-06-05 95 }
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 96
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 97 data[i] = val;
58e732ee57eae8 David Schleef 2009-02-17 98 }
58e732ee57eae8 David Schleef 2009-02-17 99
3275b4d3db1f08 H Hartley Sweeten 2013-06-05 100 return insn->n;
58e732ee57eae8 David Schleef 2009-02-17 101 }
58e732ee57eae8 David Schleef 2009-02-17 102

:::::: The code at line 61 was first introduced by commit
:::::: 42946cfc55f5cff22744bf867111be074d1c658a staging: comedi: pcmad: use comedi_timeout()

:::::: TO: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip