drivers/pinctrl/pinctrl-tb10x.c:786:21: sparse: sparse: incorrect type in assignment (different address spaces)

From: kernel test robot
Date: Mon Dec 11 2023 - 16:43:19 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a39b6ac3781d46ba18193c9dbb2110f31e9bffe9
commit: aa5222e92f8000ed3c1c38dddf11c83222aadfb3 sched/deadline: Don't use dubious signed bitfields
date: 6 years ago
config: arc-randconfig-r121-20231111 (https://download.01.org/0day-ci/archive/20231212/202312120534.7NDFPyWK-lkp@xxxxxxxxx/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231212/202312120534.7NDFPyWK-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312120534.7NDFPyWK-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/pinctrl/pinctrl-tb10x.c:786:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *base @@ got void [noderef] __iomem * @@
drivers/pinctrl/pinctrl-tb10x.c:786:21: sparse: expected void *base
drivers/pinctrl/pinctrl-tb10x.c:786:21: sparse: got void [noderef] __iomem *
>> drivers/pinctrl/pinctrl-tb10x.c:514:30: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got void *base @@
drivers/pinctrl/pinctrl-tb10x.c:514:30: sparse: expected void const volatile [noderef] __iomem *addr
drivers/pinctrl/pinctrl-tb10x.c:514:30: sparse: got void *base
>> drivers/pinctrl/pinctrl-tb10x.c:516:30: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *base @@
drivers/pinctrl/pinctrl-tb10x.c:516:30: sparse: expected void volatile [noderef] __iomem *addr
drivers/pinctrl/pinctrl-tb10x.c:516:30: sparse: got void *base
>> drivers/pinctrl/pinctrl-tb10x.c:514:30: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got void *base @@
drivers/pinctrl/pinctrl-tb10x.c:514:30: sparse: expected void const volatile [noderef] __iomem *addr
drivers/pinctrl/pinctrl-tb10x.c:514:30: sparse: got void *base
>> drivers/pinctrl/pinctrl-tb10x.c:516:30: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *base @@
drivers/pinctrl/pinctrl-tb10x.c:516:30: sparse: expected void volatile [noderef] __iomem *addr
drivers/pinctrl/pinctrl-tb10x.c:516:30: sparse: got void *base
drivers/pinctrl/pinctrl-tb10x.c:523:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got void *base @@
drivers/pinctrl/pinctrl-tb10x.c:523:31: sparse: expected void const volatile [noderef] __iomem *addr
drivers/pinctrl/pinctrl-tb10x.c:523:31: sparse: got void *base
In file included from include/linux/workqueue.h:9,
from include/linux/mm_types.h:16,
from include/linux/fs.h:22,
from include/linux/seq_file.h:11,
from include/linux/pinctrl/pinctrl.h:19,
from drivers/pinctrl/pinctrl-tb10x.c:23:
include/linux/timer.h: In function 'timer_setup':
include/linux/timer.h:159:30: warning: cast between incompatible function types from 'void (*)(struct timer_list *)' to 'void (*)(long unsigned int)' [-Wcast-function-type]
159 | __setup_timer(timer, (TIMER_FUNC_TYPE)callback,
| ^
include/linux/timer.h:126:39: note: in definition of macro '__setup_timer'
126 | (_timer)->function = (_fn); 31- | ^~~
include/linux/timer.h: In function 'timer_setup_on_stack':
include/linux/timer.h:167:39: warning: cast between incompatible function types from 'void (*)(struct timer_list *)' to 'void (*)(long unsigned int)' [-Wcast-function-type]
167 | __setup_timer_on_stack(timer, (TIMER_FUNC_TYPE)callback,
| ^
include/linux/timer.h:133:39: note: in definition of macro '__setup_timer_on_stack'
133 | (_timer)->function = (_fn); 38- | ^~~

vim +786 drivers/pinctrl/pinctrl-tb10x.c

5aad0db1c1ebb0 Christian Ruppert 2013-10-15 758
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 759 static int tb10x_pinctrl_probe(struct platform_device *pdev)
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 760 {
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 761 int ret = -EINVAL;
aa2c35e5a66194 Varka Bhadram 2014-10-21 762 struct resource *mem;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 763 struct device *dev = &pdev->dev;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 764 struct device_node *of_node = dev->of_node;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 765 struct device_node *child;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 766 struct tb10x_pinctrl *state;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 767 int i;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 768
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 769 if (!of_node) {
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 770 dev_err(dev, "No device tree node found.\n");
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 771 return -EINVAL;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 772 }
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 773
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 774 state = devm_kzalloc(dev, sizeof(struct tb10x_pinctrl) +
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 775 of_get_child_count(of_node)
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 776 * sizeof(struct tb10x_of_pinfunc),
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 777 GFP_KERNEL);
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 778 if (!state)
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 779 return -ENOMEM;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 780
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 781 platform_set_drvdata(pdev, state);
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 782 state->pinfuncs = (struct tb10x_of_pinfunc *)(state + 1);
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 783 mutex_init(&state->mutex);
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 784
aa2c35e5a66194 Varka Bhadram 2014-10-21 785 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 @786 state->base = devm_ioremap_resource(dev, mem);
86467ff2ddca94 Wei Yongjun 2013-10-21 787 if (IS_ERR(state->base)) {
86467ff2ddca94 Wei Yongjun 2013-10-21 788 ret = PTR_ERR(state->base);
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 789 goto fail;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 790 }
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 791
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 792 state->pingroups = tb10x_pingroups;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 793 state->pinfuncgrpcnt = ARRAY_SIZE(tb10x_pingroups);
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 794
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 795 for (i = 0; i < TB10X_PORTS; i++)
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 796 state->ports[i].mode = tb10x_pinctrl_get_config(state, i);
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 797
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 798 for_each_child_of_node(of_node, child) {
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 799 const char *name;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 800
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 801 if (!of_property_read_string(child, "abilis,function",
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 802 &name)) {
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 803 state->pinfuncs[state->pinfuncnt].name = child->name;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 804 state->pinfuncs[state->pinfuncnt].group = name;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 805 state->pinfuncnt++;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 806 }
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 807 }
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 808
c3a6d9e0a37df7 Laxman Dewangan 2016-02-24 809 state->pctl = devm_pinctrl_register(dev, &tb10x_pindesc, state);
323de9efdf3e75 Masahiro Yamada 2015-06-09 810 if (IS_ERR(state->pctl)) {
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 811 dev_err(dev, "could not register TB10x pin driver\n");
323de9efdf3e75 Masahiro Yamada 2015-06-09 812 ret = PTR_ERR(state->pctl);
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 813 goto fail;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 814 }
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 815
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 816 return 0;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 817
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 818 fail:
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 819 mutex_destroy(&state->mutex);
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 820 return ret;
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 821 }
5aad0db1c1ebb0 Christian Ruppert 2013-10-15 822

:::::: The code at line 786 was first introduced by commit
:::::: 5aad0db1c1ebb0f5be79f0adbecc16a2f0259b21 pinctrl: add TB10x pin control driver

:::::: TO: Christian Ruppert <christian.ruppert@xxxxxxxxxx>
:::::: CC: Linus Walleij <linus.walleij@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki