From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============0756276590693825345==" MIME-Version: 1.0 From: kbuild test robot To: kbuild-all@lists.01.org Subject: [linux-next:master 7259/7889] drivers/hwspinlock/omap_hwspinlock.c:39:39: sparse: sparse: incorrect type in initializer (different address spaces) Date: Thu, 12 Mar 2020 14:38:38 +0800 Message-ID: <202003121423.0CDSGbHT%lkp@intel.com> List-Id: --===============0756276590693825345== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Baolin, First bad commit (maybe !=3D root cause): tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git= master head: d44a64766795839eaa0f79a9e5365e8a794a1642 commit: 05eafe64881fae970470406948f2fb115f5fc347 [7259/7889] hwspinlock: Al= low drivers to be built with COMPILE_TEST reproduce: # apt-get install sparse # sparse version: v0.6.1-174-g094d5a94-dirty git checkout 05eafe64881fae970470406948f2fb115f5fc347 make ARCH=3Dx86_64 allmodconfig make C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) >> drivers/hwspinlock/omap_hwspinlock.c:39:39: sparse: sparse: incorrect ty= pe in initializer (different address spaces) @@ expected void [noderef] = *lock_addr @@ got n:2> *lock_addr @@ drivers/hwspinlock/omap_hwspinlock.c:39:39: sparse: expected void [no= deref] *lock_addr drivers/hwspinlock/omap_hwspinlock.c:39:39: sparse: got void *priv drivers/hwspinlock/omap_hwspinlock.c:47:39: sparse: sparse: incorrect ty= pe in initializer (different address spaces) @@ expected void [noderef] = *lock_addr @@ got n:2> *lock_addr @@ drivers/hwspinlock/omap_hwspinlock.c:47:39: sparse: expected void [no= deref] *lock_addr drivers/hwspinlock/omap_hwspinlock.c:47:39: sparse: got void *priv >> drivers/hwspinlock/omap_hwspinlock.c:132:30: sparse: sparse: incorrect t= ype in assignment (different address spaces) @@ expected void *priv @@ = got void [noderef] * -- >> drivers/hwspinlock/sirf_hwspinlock.c:35:39: sparse: sparse: incorrect ty= pe in initializer (different address spaces) @@ expected void [noderef] = *lock_addr @@ got n:2> *lock_addr @@ drivers/hwspinlock/sirf_hwspinlock.c:35:39: sparse: expected void [no= deref] *lock_addr drivers/hwspinlock/sirf_hwspinlock.c:35:39: sparse: got void *priv drivers/hwspinlock/sirf_hwspinlock.c:43:39: sparse: sparse: incorrect ty= pe in initializer (different address spaces) @@ expected void [noderef] = *lock_addr @@ got n:2> *lock_addr @@ drivers/hwspinlock/sirf_hwspinlock.c:43:39: sparse: expected void [no= deref] *lock_addr drivers/hwspinlock/sirf_hwspinlock.c:43:39: sparse: got void *priv >> drivers/hwspinlock/sirf_hwspinlock.c:77:30: sparse: sparse: incorrect ty= pe in assignment (different address spaces) @@ expected void *priv @@ = got void [noderef] * -- >> drivers/hwspinlock/sprd_hwspinlock.c:46:34: sparse: sparse: incorrect ty= pe in initializer (different address spaces) @@ expected void [noderef] = *addr @@ got n:2> *addr @@ drivers/hwspinlock/sprd_hwspinlock.c:46:34: sparse: expected void [no= deref] *addr drivers/hwspinlock/sprd_hwspinlock.c:46:34: sparse: got void *priv >> drivers/hwspinlock/sprd_hwspinlock.c:64:39: sparse: sparse: incorrect ty= pe in initializer (different address spaces) @@ expected void [noderef] = *lock_addr @@ got n:2> *lock_addr @@ drivers/hwspinlock/sprd_hwspinlock.c:64:39: sparse: expected void [no= deref] *lock_addr drivers/hwspinlock/sprd_hwspinlock.c:64:39: sparse: got void *priv >> drivers/hwspinlock/sprd_hwspinlock.c:131:28: sparse: sparse: incorrect t= ype in assignment (different address spaces) @@ expected void *priv @@ = got void [noderef] * -- >> drivers/hwspinlock/stm32_hwspinlock.c:30:39: sparse: sparse: incorrect t= ype in initializer (different address spaces) @@ expected void [noderef]= *lock_addr @@ got n:2> *lock_addr @@ drivers/hwspinlock/stm32_hwspinlock.c:30:39: sparse: expected void [n= oderef] *lock_addr drivers/hwspinlock/stm32_hwspinlock.c:30:39: sparse: got void *priv drivers/hwspinlock/stm32_hwspinlock.c:41:39: sparse: sparse: incorrect t= ype in initializer (different address spaces) @@ expected void [noderef]= *lock_addr @@ got n:2> *lock_addr @@ drivers/hwspinlock/stm32_hwspinlock.c:41:39: sparse: expected void [n= oderef] *lock_addr drivers/hwspinlock/stm32_hwspinlock.c:41:39: sparse: got void *priv >> drivers/hwspinlock/stm32_hwspinlock.c:78:39: sparse: sparse: incorrect t= ype in assignment (different address spaces) @@ expected void *priv @@ = got void [noderef] * -- >> drivers/hwspinlock/u8500_hsem.c:52:39: sparse: sparse: incorrect type in= initializer (different address spaces) @@ expected void [noderef] *lock_addr @@ got n:2> *lock_addr @@ drivers/hwspinlock/u8500_hsem.c:52:39: sparse: expected void [noderef= ] *lock_addr drivers/hwspinlock/u8500_hsem.c:52:39: sparse: got void *priv drivers/hwspinlock/u8500_hsem.c:65:39: sparse: sparse: incorrect type in= initializer (different address spaces) @@ expected void [noderef] *lock_addr @@ got n:2> *lock_addr @@ drivers/hwspinlock/u8500_hsem.c:65:39: sparse: expected void [noderef= ] *lock_addr drivers/hwspinlock/u8500_hsem.c:65:39: sparse: got void *priv >> drivers/hwspinlock/u8500_hsem.c:116:30: sparse: sparse: incorrect type i= n assignment (different address spaces) @@ expected void *priv @@ got= void [noderef] * >> drivers/hwspinlock/u8500_hsem.c:126:52: sparse: sparse: incorrect type i= n initializer (different address spaces) @@ expected void [noderef] *io_base @@ got n:2> *io_base @@ drivers/hwspinlock/u8500_hsem.c:126:52: sparse: expected void [nodere= f] *io_base drivers/hwspinlock/u8500_hsem.c:126:52: sparse: got void * vim +39 drivers/hwspinlock/omap_hwspinlock.c 70ba4cc26b9f53 Simon Que 2011-02-17 36 = 70ba4cc26b9f53 Simon Que 2011-02-17 37 static int omap_hwspinlock_t= rylock(struct hwspinlock *lock) 70ba4cc26b9f53 Simon Que 2011-02-17 38 { 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 @39 void __iomem *lock_addr =3D= lock->priv; 70ba4cc26b9f53 Simon Que 2011-02-17 40 = 70ba4cc26b9f53 Simon Que 2011-02-17 41 /* attempt to acquire the l= ock by reading its value */ 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 42 return (SPINLOCK_NOTTAKEN = =3D=3D readl(lock_addr)); 70ba4cc26b9f53 Simon Que 2011-02-17 43 } 70ba4cc26b9f53 Simon Que 2011-02-17 44 = 70ba4cc26b9f53 Simon Que 2011-02-17 45 static void omap_hwspinlock_= unlock(struct hwspinlock *lock) 70ba4cc26b9f53 Simon Que 2011-02-17 46 { 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 47 void __iomem *lock_addr =3D= lock->priv; 70ba4cc26b9f53 Simon Que 2011-02-17 48 = 70ba4cc26b9f53 Simon Que 2011-02-17 49 /* release the lock by writ= ing 0 to it */ 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 50 writel(SPINLOCK_NOTTAKEN, l= ock_addr); 70ba4cc26b9f53 Simon Que 2011-02-17 51 } 70ba4cc26b9f53 Simon Que 2011-02-17 52 = 70ba4cc26b9f53 Simon Que 2011-02-17 53 /* 70ba4cc26b9f53 Simon Que 2011-02-17 54 * relax the OMAP interconne= ct while spinning on it. 70ba4cc26b9f53 Simon Que 2011-02-17 55 * 70ba4cc26b9f53 Simon Que 2011-02-17 56 * The specs recommended tha= t the retry delay time will be 70ba4cc26b9f53 Simon Que 2011-02-17 57 * just over half of the tim= e that a requester would be 70ba4cc26b9f53 Simon Que 2011-02-17 58 * expected to hold the lock. 70ba4cc26b9f53 Simon Que 2011-02-17 59 * 70ba4cc26b9f53 Simon Que 2011-02-17 60 * The number below is taken= from an hardware specs example, 70ba4cc26b9f53 Simon Que 2011-02-17 61 * obviously it is somewhat = arbitrary. 70ba4cc26b9f53 Simon Que 2011-02-17 62 */ 70ba4cc26b9f53 Simon Que 2011-02-17 63 static void omap_hwspinlock_= relax(struct hwspinlock *lock) 70ba4cc26b9f53 Simon Que 2011-02-17 64 { 70ba4cc26b9f53 Simon Que 2011-02-17 65 ndelay(50); 70ba4cc26b9f53 Simon Que 2011-02-17 66 } 70ba4cc26b9f53 Simon Que 2011-02-17 67 = 70ba4cc26b9f53 Simon Que 2011-02-17 68 static const struct hwspinlo= ck_ops omap_hwspinlock_ops =3D { 70ba4cc26b9f53 Simon Que 2011-02-17 69 .trylock =3D omap_hwspinloc= k_trylock, 70ba4cc26b9f53 Simon Que 2011-02-17 70 .unlock =3D omap_hwspinlock= _unlock, 70ba4cc26b9f53 Simon Que 2011-02-17 71 .relax =3D omap_hwspinlock_= relax, 70ba4cc26b9f53 Simon Que 2011-02-17 72 }; 70ba4cc26b9f53 Simon Que 2011-02-17 73 = 571291066d053c Bill Pemberton 2012-11-19 74 static int omap_hwspinlock_p= robe(struct platform_device *pdev) 70ba4cc26b9f53 Simon Que 2011-02-17 75 { 65bd4341d61678 Suman Anna 2015-03-04 76 struct device_node *node = =3D pdev->dev.of_node; 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 77 struct hwspinlock_device *b= ank; 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 78 struct hwspinlock *hwlock; 70ba4cc26b9f53 Simon Que 2011-02-17 79 void __iomem *io_base; 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 80 int num_locks, i, ret; 65bd4341d61678 Suman Anna 2015-03-04 81 /* Only a single hwspinlock= block device is supported */ 65bd4341d61678 Suman Anna 2015-03-04 82 int base_id =3D 0; 70ba4cc26b9f53 Simon Que 2011-02-17 83 = 65bd4341d61678 Suman Anna 2015-03-04 84 if (!node) c3c1250e93a7ab Ohad Ben-Cohen 2011-09-05 85 return -ENODEV; c3c1250e93a7ab Ohad Ben-Cohen 2011-09-05 86 = bf2740068a87e2 Baolin Wang 2020-01-08 87 io_base =3D devm_platform_i= oremap_resource(pdev, 0); bf2740068a87e2 Baolin Wang 2020-01-08 88 if (IS_ERR(io_base)) bf2740068a87e2 Baolin Wang 2020-01-08 89 return PTR_ERR(io_base); 70ba4cc26b9f53 Simon Que 2011-02-17 90 = e1e4528f8c9962 Suman Anna 2014-07-02 91 /* e1e4528f8c9962 Suman Anna 2014-07-02 92 * make sure the module is = enabled and clocked before reading e1e4528f8c9962 Suman Anna 2014-07-02 93 * the module SYSSTATUS reg= ister e1e4528f8c9962 Suman Anna 2014-07-02 94 */ e1e4528f8c9962 Suman Anna 2014-07-02 95 pm_runtime_enable(&pdev->de= v); e1e4528f8c9962 Suman Anna 2014-07-02 96 ret =3D pm_runtime_get_sync= (&pdev->dev); e1e4528f8c9962 Suman Anna 2014-07-02 97 if (ret < 0) { e1e4528f8c9962 Suman Anna 2014-07-02 98 pm_runtime_put_noidle(&pde= v->dev); bf2740068a87e2 Baolin Wang 2020-01-08 99 goto runtime_err; e1e4528f8c9962 Suman Anna 2014-07-02 100 } e1e4528f8c9962 Suman Anna 2014-07-02 101 = 70ba4cc26b9f53 Simon Que 2011-02-17 102 /* Determine number of lock= s */ 70ba4cc26b9f53 Simon Que 2011-02-17 103 i =3D readl(io_base + SYSST= ATUS_OFFSET); 70ba4cc26b9f53 Simon Que 2011-02-17 104 i >>=3D SPINLOCK_NUMLOCKS_B= IT_OFFSET; 70ba4cc26b9f53 Simon Que 2011-02-17 105 = e1e4528f8c9962 Suman Anna 2014-07-02 106 /* e1e4528f8c9962 Suman Anna 2014-07-02 107 * runtime PM will make sur= e the clock of this module is e1e4528f8c9962 Suman Anna 2014-07-02 108 * enabled again iff at lea= st one lock is requested e1e4528f8c9962 Suman Anna 2014-07-02 109 */ e1e4528f8c9962 Suman Anna 2014-07-02 110 ret =3D pm_runtime_put(&pde= v->dev); e1e4528f8c9962 Suman Anna 2014-07-02 111 if (ret < 0) bf2740068a87e2 Baolin Wang 2020-01-08 112 goto runtime_err; e1e4528f8c9962 Suman Anna 2014-07-02 113 = 70ba4cc26b9f53 Simon Que 2011-02-17 114 /* one of the four lsb's mu= st be set, and nothing else */ 70ba4cc26b9f53 Simon Que 2011-02-17 115 if (hweight_long(i & 0xf) != =3D 1 || i > 8) { 70ba4cc26b9f53 Simon Que 2011-02-17 116 ret =3D -EINVAL; bf2740068a87e2 Baolin Wang 2020-01-08 117 goto runtime_err; 70ba4cc26b9f53 Simon Que 2011-02-17 118 } 70ba4cc26b9f53 Simon Que 2011-02-17 119 = 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 120 num_locks =3D i * 32; /* ac= tual number of locks in this device */ c97f6dd0fe21df Ohad Ben-Cohen 2011-09-05 121 = 42f291ebfdd83a Baolin Wang 2020-01-08 122 bank =3D devm_kzalloc(&pdev= ->dev, struct_size(bank, lock, num_locks), 42f291ebfdd83a Baolin Wang 2020-01-08 123 GFP_KERNEL); 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 124 if (!bank) { c97f6dd0fe21df Ohad Ben-Cohen 2011-09-05 125 ret =3D -ENOMEM; bf2740068a87e2 Baolin Wang 2020-01-08 126 goto runtime_err; c97f6dd0fe21df Ohad Ben-Cohen 2011-09-05 127 } c97f6dd0fe21df Ohad Ben-Cohen 2011-09-05 128 = 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 129 platform_set_drvdata(pdev, = bank); 70ba4cc26b9f53 Simon Que 2011-02-17 130 = 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 131 for (i =3D 0, hwlock =3D &b= ank->lock[0]; i < num_locks; i++, hwlock++) 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 @132 hwlock->priv =3D io_base += LOCK_BASE_OFFSET + sizeof(u32) * i; 70ba4cc26b9f53 Simon Que 2011-02-17 133 = 300bab9770e2bd Ohad Ben-Cohen 2011-09-06 134 ret =3D hwspin_lock_registe= r(bank, &pdev->dev, &omap_hwspinlock_ops, 65bd4341d61678 Suman Anna 2015-03-04 135 base_id, num_locks); c97f6dd0fe21df Ohad Ben-Cohen 2011-09-05 136 if (ret) 42f291ebfdd83a Baolin Wang 2020-01-08 137 goto runtime_err; 70ba4cc26b9f53 Simon Que 2011-02-17 138 = d4d98bba3ea58e Suman Anna 2019-05-30 139 dev_dbg(&pdev->dev, "Regist= ered %d locks with HwSpinlock core\n", d4d98bba3ea58e Suman Anna 2019-05-30 140 num_locks); d4d98bba3ea58e Suman Anna 2019-05-30 141 = 70ba4cc26b9f53 Simon Que 2011-02-17 142 return 0; 70ba4cc26b9f53 Simon Que 2011-02-17 143 = bf2740068a87e2 Baolin Wang 2020-01-08 144 runtime_err: e1e4528f8c9962 Suman Anna 2014-07-02 145 pm_runtime_disable(&pdev->d= ev); 70ba4cc26b9f53 Simon Que 2011-02-17 146 return ret; 70ba4cc26b9f53 Simon Que 2011-02-17 147 } 70ba4cc26b9f53 Simon Que 2011-02-17 148 = :::::: The code at line 39 was first introduced by commit :::::: 300bab9770e2bd10262bcc78e7249fdce2c74b38 hwspinlock/core: register a= bank of hwspinlocks in a single API call :::::: TO: Ohad Ben-Cohen :::::: CC: Ohad Ben-Cohen --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============0756276590693825345==--