lkml.org 
[lkml]   [2020]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectdrivers/hwspinlock/stm32_hwspinlock.c:30:39: sparse: sparse: incorrect type in initializer (different address spaces)
Hi Baolin,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b0c3ba31be3e45a130e13b278cf3b90f69bda6f6
commit: ffd0bbfb378ecd56eac22bf932ccdbf89ac7f725 hwspinlock: Allow drivers to be built with COMPILE_TEST
date: 9 weeks ago
config: mips-randconfig-s032-20200527 (attached as .config)
compiler: mips64-linux-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-240-gf0fe1cd9-dirty
git checkout ffd0bbfb378ecd56eac22bf932ccdbf89ac7f725
# save the attached .config to linux build tree
make W=1 C=1 ARCH=mips CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> drivers/hwspinlock/stm32_hwspinlock.c:30:39: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] <asn:2> *lock_addr @@ got void *priv @@
drivers/hwspinlock/stm32_hwspinlock.c:30:39: sparse: expected void [noderef] <asn:2> *lock_addr
drivers/hwspinlock/stm32_hwspinlock.c:30:39: sparse: got void *priv
drivers/hwspinlock/stm32_hwspinlock.c:41:39: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] <asn:2> *lock_addr @@ got void *priv @@
drivers/hwspinlock/stm32_hwspinlock.c:41:39: sparse: expected void [noderef] <asn:2> *lock_addr
drivers/hwspinlock/stm32_hwspinlock.c:41:39: sparse: got void *priv
>> drivers/hwspinlock/stm32_hwspinlock.c:78:39: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *priv @@ got void [noderef] <asn:2> * @@
drivers/hwspinlock/stm32_hwspinlock.c:78:39: sparse: expected void *priv
drivers/hwspinlock/stm32_hwspinlock.c:78:39: sparse: got void [noderef] <asn:2> *
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
--
>> drivers/hwspinlock/sirf_hwspinlock.c:35:39: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] <asn:2> *lock_addr @@ got void *priv @@
drivers/hwspinlock/sirf_hwspinlock.c:35:39: sparse: expected void [noderef] <asn:2> *lock_addr
drivers/hwspinlock/sirf_hwspinlock.c:35:39: sparse: got void *priv
drivers/hwspinlock/sirf_hwspinlock.c:43:39: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] <asn:2> *lock_addr @@ got void *priv @@
drivers/hwspinlock/sirf_hwspinlock.c:43:39: sparse: expected void [noderef] <asn:2> *lock_addr
drivers/hwspinlock/sirf_hwspinlock.c:43:39: sparse: got void *priv
>> drivers/hwspinlock/sirf_hwspinlock.c:77:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *priv @@ got void [noderef] <asn:2> * @@
drivers/hwspinlock/sirf_hwspinlock.c:77:30: sparse: expected void *priv
drivers/hwspinlock/sirf_hwspinlock.c:77:30: sparse: got void [noderef] <asn:2> *
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32
arch/mips/include/asm/io.h:429:1: sparse: sparse: cast to restricted __le32

vim +30 drivers/hwspinlock/stm32_hwspinlock.c

f24fcff1d267da Benjamin Gaignard 2018-11-14 27
f24fcff1d267da Benjamin Gaignard 2018-11-14 28 static int stm32_hwspinlock_trylock(struct hwspinlock *lock)
f24fcff1d267da Benjamin Gaignard 2018-11-14 29 {
f24fcff1d267da Benjamin Gaignard 2018-11-14 @30 void __iomem *lock_addr = lock->priv;
f24fcff1d267da Benjamin Gaignard 2018-11-14 31 u32 status;
f24fcff1d267da Benjamin Gaignard 2018-11-14 32
f24fcff1d267da Benjamin Gaignard 2018-11-14 33 writel(STM32_MUTEX_LOCK_BIT | STM32_MUTEX_COREID, lock_addr);
f24fcff1d267da Benjamin Gaignard 2018-11-14 34 status = readl(lock_addr);
f24fcff1d267da Benjamin Gaignard 2018-11-14 35
f24fcff1d267da Benjamin Gaignard 2018-11-14 36 return status == (STM32_MUTEX_LOCK_BIT | STM32_MUTEX_COREID);
f24fcff1d267da Benjamin Gaignard 2018-11-14 37 }
f24fcff1d267da Benjamin Gaignard 2018-11-14 38
f24fcff1d267da Benjamin Gaignard 2018-11-14 39 static void stm32_hwspinlock_unlock(struct hwspinlock *lock)
f24fcff1d267da Benjamin Gaignard 2018-11-14 40 {
f24fcff1d267da Benjamin Gaignard 2018-11-14 41 void __iomem *lock_addr = lock->priv;
f24fcff1d267da Benjamin Gaignard 2018-11-14 42
f24fcff1d267da Benjamin Gaignard 2018-11-14 43 writel(STM32_MUTEX_COREID, lock_addr);
f24fcff1d267da Benjamin Gaignard 2018-11-14 44 }
f24fcff1d267da Benjamin Gaignard 2018-11-14 45
5cd69f13deef80 Fabien Dessenne 2019-03-07 46 static void stm32_hwspinlock_relax(struct hwspinlock *lock)
5cd69f13deef80 Fabien Dessenne 2019-03-07 47 {
5cd69f13deef80 Fabien Dessenne 2019-03-07 48 ndelay(50);
5cd69f13deef80 Fabien Dessenne 2019-03-07 49 }
5cd69f13deef80 Fabien Dessenne 2019-03-07 50
f24fcff1d267da Benjamin Gaignard 2018-11-14 51 static const struct hwspinlock_ops stm32_hwspinlock_ops = {
f24fcff1d267da Benjamin Gaignard 2018-11-14 52 .trylock = stm32_hwspinlock_trylock,
f24fcff1d267da Benjamin Gaignard 2018-11-14 53 .unlock = stm32_hwspinlock_unlock,
5cd69f13deef80 Fabien Dessenne 2019-03-07 54 .relax = stm32_hwspinlock_relax,
f24fcff1d267da Benjamin Gaignard 2018-11-14 55 };
f24fcff1d267da Benjamin Gaignard 2018-11-14 56
f24fcff1d267da Benjamin Gaignard 2018-11-14 57 static int stm32_hwspinlock_probe(struct platform_device *pdev)
f24fcff1d267da Benjamin Gaignard 2018-11-14 58 {
f24fcff1d267da Benjamin Gaignard 2018-11-14 59 struct stm32_hwspinlock *hw;
f24fcff1d267da Benjamin Gaignard 2018-11-14 60 void __iomem *io_base;
f24fcff1d267da Benjamin Gaignard 2018-11-14 61 size_t array_size;
f24fcff1d267da Benjamin Gaignard 2018-11-14 62 int i, ret;
f24fcff1d267da Benjamin Gaignard 2018-11-14 63
d4824486b676ef Yangtao Li 2019-12-28 64 io_base = devm_platform_ioremap_resource(pdev, 0);
4d5a91fd1f42a8 Wei Yongjun 2019-01-03 65 if (IS_ERR(io_base))
4d5a91fd1f42a8 Wei Yongjun 2019-01-03 66 return PTR_ERR(io_base);
f24fcff1d267da Benjamin Gaignard 2018-11-14 67
f24fcff1d267da Benjamin Gaignard 2018-11-14 68 array_size = STM32_MUTEX_NUM_LOCKS * sizeof(struct hwspinlock);
f24fcff1d267da Benjamin Gaignard 2018-11-14 69 hw = devm_kzalloc(&pdev->dev, sizeof(*hw) + array_size, GFP_KERNEL);
f24fcff1d267da Benjamin Gaignard 2018-11-14 70 if (!hw)
f24fcff1d267da Benjamin Gaignard 2018-11-14 71 return -ENOMEM;
f24fcff1d267da Benjamin Gaignard 2018-11-14 72
f24fcff1d267da Benjamin Gaignard 2018-11-14 73 hw->clk = devm_clk_get(&pdev->dev, "hsem");
f24fcff1d267da Benjamin Gaignard 2018-11-14 74 if (IS_ERR(hw->clk))
f24fcff1d267da Benjamin Gaignard 2018-11-14 75 return PTR_ERR(hw->clk);
f24fcff1d267da Benjamin Gaignard 2018-11-14 76
f24fcff1d267da Benjamin Gaignard 2018-11-14 77 for (i = 0; i < STM32_MUTEX_NUM_LOCKS; i++)
f24fcff1d267da Benjamin Gaignard 2018-11-14 @78 hw->bank.lock[i].priv = io_base + i * sizeof(u32);
f24fcff1d267da Benjamin Gaignard 2018-11-14 79
f24fcff1d267da Benjamin Gaignard 2018-11-14 80 platform_set_drvdata(pdev, hw);
f24fcff1d267da Benjamin Gaignard 2018-11-14 81 pm_runtime_enable(&pdev->dev);
f24fcff1d267da Benjamin Gaignard 2018-11-14 82
f24fcff1d267da Benjamin Gaignard 2018-11-14 83 ret = hwspin_lock_register(&hw->bank, &pdev->dev, &stm32_hwspinlock_ops,
f24fcff1d267da Benjamin Gaignard 2018-11-14 84 0, STM32_MUTEX_NUM_LOCKS);
f24fcff1d267da Benjamin Gaignard 2018-11-14 85
f24fcff1d267da Benjamin Gaignard 2018-11-14 86 if (ret)
f24fcff1d267da Benjamin Gaignard 2018-11-14 87 pm_runtime_disable(&pdev->dev);
f24fcff1d267da Benjamin Gaignard 2018-11-14 88
f24fcff1d267da Benjamin Gaignard 2018-11-14 89 return ret;
f24fcff1d267da Benjamin Gaignard 2018-11-14 90 }
f24fcff1d267da Benjamin Gaignard 2018-11-14 91

:::::: The code at line 30 was first introduced by commit
:::::: f24fcff1d267da08c4bbb3869e7f4b36ce916b76 hwspinlock: add STM32 hwspinlock device

:::::: TO: Benjamin Gaignard <benjamin.gaignard@st.com>
:::::: CC: Bjorn Andersson <bjorn.andersson@linaro.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2020-05-27 23:29    [W:0.040 / U:3.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site