drivers/gpio/gpio-mxs.c:362:21: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Tue Aug 11 2020 - 05:54:57 EST


Hi Anson,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 00e4db51259a5f936fec1424b884f029479d3981
commit: 6876ca311bfca5d7cae30c4b529aeb9449c072eb gpio: mxs: add COMPILE_TEST support for GPIO_MXS
date: 5 months ago
config: openrisc-randconfig-s031-20200811 (attached as .config)
compiler: or1k-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-168-g9554805c-dirty
git checkout 6876ca311bfca5d7cae30c4b529aeb9449c072eb
# 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=openrisc

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/gpio/gpio-mxs.c:362:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] <asn:2> *base @@
>> drivers/gpio/gpio-mxs.c:362:21: sparse: expected void *addr
>> drivers/gpio/gpio-mxs.c:362:21: sparse: got void [noderef] <asn:2> *base
drivers/gpio/gpio-mxs.c: note: in included file (through arch/openrisc/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]

vim +362 drivers/gpio/gpio-mxs.c

4052d45e800ce3 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 276
3836309d93462b drivers/gpio/gpio-mxs.c Bill Pemberton 2012-11-19 277 static int mxs_gpio_probe(struct platform_device *pdev)
fba311fcf09873 arch/arm/mach-mxs/gpio.c Shawn Guo 2010-12-18 278 {
4052d45e800ce3 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 279 struct device_node *np = pdev->dev.of_node;
4052d45e800ce3 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 280 struct device_node *parent;
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 281 static void __iomem *base;
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 282 struct mxs_gpio_port *port;
0b76c5412146c1 drivers/gpio/gpio-mxs.c Shawn Guo 2012-08-20 283 int irq_base;
498c17cf6a9353 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-07 284 int err;
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 285
940a4f7b51f7ad drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 286 port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL);
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 287 if (!port)
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 288 return -ENOMEM;
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 289
4052d45e800ce3 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 290 port->id = of_alias_get_id(np, "gpio");
4052d45e800ce3 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 291 if (port->id < 0)
4052d45e800ce3 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 292 return port->id;
1f2d357b9ebef5 drivers/gpio/gpio-mxs.c Thierry Reding 2018-04-30 293 port->devid = (enum mxs_gpio_id)of_device_get_match_data(&pdev->dev);
5751d3dcf43e24 drivers/gpio/gpio-mxs.c Bartosz Golaszewski 2017-08-09 294 port->dev = &pdev->dev;
940a4f7b51f7ad drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 295 port->irq = platform_get_irq(pdev, 0);
940a4f7b51f7ad drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 296 if (port->irq < 0)
940a4f7b51f7ad drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 297 return port->irq;
940a4f7b51f7ad drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 298
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 299 /*
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 300 * map memory region only once, as all the gpio ports
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 301 * share the same one
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 302 */
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 303 if (!base) {
4052d45e800ce3 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 304 parent = of_get_parent(np);
4052d45e800ce3 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 305 base = of_iomap(parent, 0);
4052d45e800ce3 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 306 of_node_put(parent);
641d03422a59b1 drivers/gpio/gpio-mxs.c Thierry Reding 2013-01-21 307 if (!base)
641d03422a59b1 drivers/gpio/gpio-mxs.c Thierry Reding 2013-01-21 308 return -EADDRNOTAVAIL;
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 309 }
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 310 port->base = base;
fba311fcf09873 arch/arm/mach-mxs/gpio.c Shawn Guo 2010-12-18 311
f08ea3cc94eeaf drivers/gpio/gpio-mxs.c Sascha Hauer 2016-10-21 312 /* initially disable the interrupts */
f08ea3cc94eeaf drivers/gpio/gpio-mxs.c Sascha Hauer 2016-10-21 313 writel(0, port->base + PINCTRL_PIN2IRQ(port));
164387d2b4ae20 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-03 314 writel(0, port->base + PINCTRL_IRQEN(port));
fba311fcf09873 arch/arm/mach-mxs/gpio.c Shawn Guo 2010-12-18 315
fba311fcf09873 arch/arm/mach-mxs/gpio.c Shawn Guo 2010-12-18 316 /* clear address has to be used to clear IRQSTAT bits */
164387d2b4ae20 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-03 317 writel(~0U, port->base + PINCTRL_IRQSTAT(port) + MXS_CLR);
fba311fcf09873 arch/arm/mach-mxs/gpio.c Shawn Guo 2010-12-18 318
8514b5439c90f0 drivers/gpio/gpio-mxs.c Bartosz Golaszewski 2017-03-04 319 irq_base = devm_irq_alloc_descs(&pdev->dev, -1, 0, 32, numa_node_id());
44df08198bc98d drivers/gpio/gpio-mxs.c Arvind Yadav 2016-10-05 320 if (irq_base < 0) {
44df08198bc98d drivers/gpio/gpio-mxs.c Arvind Yadav 2016-10-05 321 err = irq_base;
44df08198bc98d drivers/gpio/gpio-mxs.c Arvind Yadav 2016-10-05 322 goto out_iounmap;
44df08198bc98d drivers/gpio/gpio-mxs.c Arvind Yadav 2016-10-05 323 }
0b76c5412146c1 drivers/gpio/gpio-mxs.c Shawn Guo 2012-08-20 324
0b76c5412146c1 drivers/gpio/gpio-mxs.c Shawn Guo 2012-08-20 325 port->domain = irq_domain_add_legacy(np, 32, irq_base, 0,
0b76c5412146c1 drivers/gpio/gpio-mxs.c Shawn Guo 2012-08-20 326 &irq_domain_simple_ops, NULL);
0b76c5412146c1 drivers/gpio/gpio-mxs.c Shawn Guo 2012-08-20 327 if (!port->domain) {
0b76c5412146c1 drivers/gpio/gpio-mxs.c Shawn Guo 2012-08-20 328 err = -ENODEV;
8514b5439c90f0 drivers/gpio/gpio-mxs.c Bartosz Golaszewski 2017-03-04 329 goto out_iounmap;
0b76c5412146c1 drivers/gpio/gpio-mxs.c Shawn Guo 2012-08-20 330 }
0b76c5412146c1 drivers/gpio/gpio-mxs.c Shawn Guo 2012-08-20 331
498c17cf6a9353 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-07 332 /* gpio-mxs can be a generic irq chip */
1bbc557d976b4e drivers/gpio/gpio-mxs.c Peng Fan 2015-08-23 333 err = mxs_gpio_init_gc(port, irq_base);
1bbc557d976b4e drivers/gpio/gpio-mxs.c Peng Fan 2015-08-23 334 if (err < 0)
1bbc557d976b4e drivers/gpio/gpio-mxs.c Peng Fan 2015-08-23 335 goto out_irqdomain_remove;
fba311fcf09873 arch/arm/mach-mxs/gpio.c Shawn Guo 2010-12-18 336
fba311fcf09873 arch/arm/mach-mxs/gpio.c Shawn Guo 2010-12-18 337 /* setup one handler for each entry */
a44735f421b447 drivers/gpio/gpio-mxs.c Russell King 2015-06-16 338 irq_set_chained_handler_and_data(port->irq, mxs_gpio_irq_handler,
a44735f421b447 drivers/gpio/gpio-mxs.c Russell King 2015-06-16 339 port);
fba311fcf09873 arch/arm/mach-mxs/gpio.c Shawn Guo 2010-12-18 340
0f4630f3720e7e drivers/gpio/gpio-mxs.c Linus Walleij 2015-12-04 341 err = bgpio_init(&port->gc, &pdev->dev, 4,
164387d2b4ae20 drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-03 342 port->base + PINCTRL_DIN(port),
90dae4ebf03063 drivers/gpio/gpio-mxs.c Maxime Ripard 2013-04-29 343 port->base + PINCTRL_DOUT(port) + MXS_SET,
90dae4ebf03063 drivers/gpio/gpio-mxs.c Maxime Ripard 2013-04-29 344 port->base + PINCTRL_DOUT(port) + MXS_CLR,
84a442b9a16ee6 drivers/gpio/gpio-mxs.c Linus Torvalds 2012-05-26 345 port->base + PINCTRL_DOE(port), NULL, 0);
8d7cf8370d5fb7 drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 346 if (err)
0f4630f3720e7e drivers/gpio/gpio-mxs.c Linus Walleij 2015-12-04 347 goto out_irqdomain_remove;
fba311fcf09873 arch/arm/mach-mxs/gpio.c Shawn Guo 2010-12-18 348
0f4630f3720e7e drivers/gpio/gpio-mxs.c Linus Walleij 2015-12-04 349 port->gc.to_irq = mxs_gpio_to_irq;
0f4630f3720e7e drivers/gpio/gpio-mxs.c Linus Walleij 2015-12-04 350 port->gc.get_direction = mxs_gpio_get_direction;
0f4630f3720e7e drivers/gpio/gpio-mxs.c Linus Walleij 2015-12-04 351 port->gc.base = port->id * 32;
06f88a8ae9085e drivers/gpio/gpio-mxs.c Shawn Guo 2011-06-06 352
0f4630f3720e7e drivers/gpio/gpio-mxs.c Linus Walleij 2015-12-04 353 err = gpiochip_add_data(&port->gc, port);
0b76c5412146c1 drivers/gpio/gpio-mxs.c Shawn Guo 2012-08-20 354 if (err)
0f4630f3720e7e drivers/gpio/gpio-mxs.c Linus Walleij 2015-12-04 355 goto out_irqdomain_remove;
fba311fcf09873 arch/arm/mach-mxs/gpio.c Shawn Guo 2010-12-18 356
940a4f7b51f7ad drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 357 return 0;
0b76c5412146c1 drivers/gpio/gpio-mxs.c Shawn Guo 2012-08-20 358
1bbc557d976b4e drivers/gpio/gpio-mxs.c Peng Fan 2015-08-23 359 out_irqdomain_remove:
1bbc557d976b4e drivers/gpio/gpio-mxs.c Peng Fan 2015-08-23 360 irq_domain_remove(port->domain);
44df08198bc98d drivers/gpio/gpio-mxs.c Arvind Yadav 2016-10-05 361 out_iounmap:
44df08198bc98d drivers/gpio/gpio-mxs.c Arvind Yadav 2016-10-05 @362 iounmap(port->base);
0b76c5412146c1 drivers/gpio/gpio-mxs.c Shawn Guo 2012-08-20 363 return err;
940a4f7b51f7ad drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 364 }
940a4f7b51f7ad drivers/gpio/gpio-mxs.c Shawn Guo 2012-05-04 365

:::::: The code at line 362 was first introduced by commit
:::::: 44df08198bc98d75085bb0ff4b54bf43e0bc40c0 gpio: mxs: Unmap region obtained by of_iomap

:::::: TO: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
:::::: CC: Linus Walleij <linus.walleij@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip