sound/soc/mediatek/common/mtk-btcvsd.c:1367:30: sparse: sparse: incorrect type in assignment (different address spaces)
From: kernel test robot
Date: Thu Nov 25 2021 - 09:41:04 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5f53fa508db098c9d372423a6dac31c8a5679cdf
commit: 6746cc858259985a945a07075a19ec4d24352407 ASoC: mediatek: mt8195: add platform driver
date: 3 months ago
config: alpha-randconfig-s032-20211117 (https://download.01.org/0day-ci/archive/20211125/202111252251.6a95AjTD-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 11.2.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.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6746cc858259985a945a07075a19ec4d24352407
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 6746cc858259985a945a07075a19ec4d24352407
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=alpha
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> sound/soc/mediatek/common/mtk-btcvsd.c:1367:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned int [usertype] *bt_reg_pkt_r @@ got void [noderef] __iomem * @@
sound/soc/mediatek/common/mtk-btcvsd.c:1367:30: sparse: expected unsigned int [usertype] *bt_reg_pkt_r
sound/soc/mediatek/common/mtk-btcvsd.c:1367:30: sparse: got void [noderef] __iomem *
>> sound/soc/mediatek/common/mtk-btcvsd.c:1369:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned int [usertype] *bt_reg_pkt_w @@ got void [noderef] __iomem * @@
sound/soc/mediatek/common/mtk-btcvsd.c:1369:30: sparse: expected unsigned int [usertype] *bt_reg_pkt_w
sound/soc/mediatek/common/mtk-btcvsd.c:1369:30: sparse: got void [noderef] __iomem *
>> sound/soc/mediatek/common/mtk-btcvsd.c:1371:28: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned int [usertype] *bt_reg_ctl @@ got void [noderef] __iomem * @@
sound/soc/mediatek/common/mtk-btcvsd.c:1371:28: sparse: expected unsigned int [usertype] *bt_reg_ctl
sound/soc/mediatek/common/mtk-btcvsd.c:1371:28: sparse: got void [noderef] __iomem *
vim +1367 sound/soc/mediatek/common/mtk-btcvsd.c
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1281
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1282 static int mtk_btcvsd_snd_probe(struct platform_device *pdev)
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1283 {
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1284 int ret;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1285 int irq_id;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1286 u32 offset[5] = {0, 0, 0, 0, 0};
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1287 struct mtk_btcvsd_snd *btcvsd;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1288 struct device *dev = &pdev->dev;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1289
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1290 /* init btcvsd private data */
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1291 btcvsd = devm_kzalloc(dev, sizeof(*btcvsd), GFP_KERNEL);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1292 if (!btcvsd)
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1293 return -ENOMEM;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1294 platform_set_drvdata(pdev, btcvsd);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1295 btcvsd->dev = dev;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1296
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1297 /* init tx/rx */
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1298 btcvsd->rx = devm_kzalloc(btcvsd->dev, sizeof(*btcvsd->rx), GFP_KERNEL);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1299 if (!btcvsd->rx)
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1300 return -ENOMEM;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1301
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1302 btcvsd->tx = devm_kzalloc(btcvsd->dev, sizeof(*btcvsd->tx), GFP_KERNEL);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1303 if (!btcvsd->tx)
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1304 return -ENOMEM;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1305
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1306 spin_lock_init(&btcvsd->tx_lock);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1307 spin_lock_init(&btcvsd->rx_lock);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1308
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1309 init_waitqueue_head(&btcvsd->tx_wait);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1310 init_waitqueue_head(&btcvsd->rx_wait);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1311
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1312 mtk_btcvsd_snd_tx_init(btcvsd);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1313 mtk_btcvsd_snd_rx_init(btcvsd);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1314
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1315 /* irq */
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1316 irq_id = platform_get_irq(pdev, 0);
cf9441adb1a3550 Stephen Boyd 2019-07-30 1317 if (irq_id <= 0)
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1318 return irq_id < 0 ? irq_id : -ENXIO;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1319
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1320 ret = devm_request_irq(dev, irq_id, mtk_btcvsd_snd_irq_handler,
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1321 IRQF_TRIGGER_LOW, "BTCVSD_ISR_Handle",
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1322 (void *)btcvsd);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1323 if (ret) {
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1324 dev_err(dev, "could not request_irq for BTCVSD_ISR_Handle\n");
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1325 return ret;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1326 }
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1327
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1328 btcvsd->irq_id = irq_id;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1329
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1330 /* iomap */
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1331 btcvsd->bt_pkv_base = of_iomap(dev->of_node, 0);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1332 if (!btcvsd->bt_pkv_base) {
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1333 dev_err(dev, "iomap bt_pkv_base fail\n");
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1334 return -EIO;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1335 }
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1336
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1337 btcvsd->bt_sram_bank2_base = of_iomap(dev->of_node, 1);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1338 if (!btcvsd->bt_sram_bank2_base) {
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1339 dev_err(dev, "iomap bt_sram_bank2_base fail\n");
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1340 ret = -EIO;
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1341 goto unmap_pkv_err;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1342 }
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1343
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1344 btcvsd->infra = syscon_regmap_lookup_by_phandle(dev->of_node,
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1345 "mediatek,infracfg");
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1346 if (IS_ERR(btcvsd->infra)) {
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1347 dev_err(dev, "cannot find infra controller: %ld\n",
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1348 PTR_ERR(btcvsd->infra));
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1349 ret = PTR_ERR(btcvsd->infra);
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1350 goto unmap_bank2_err;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1351 }
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1352
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1353 /* get offset */
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1354 ret = of_property_read_u32_array(dev->of_node, "mediatek,offset",
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1355 offset,
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1356 ARRAY_SIZE(offset));
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1357 if (ret) {
766cc4965a3a2a8 Colin Ian King 2019-02-04 1358 dev_warn(dev, "%s(), get offset fail, ret %d\n", __func__, ret);
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1359 goto unmap_bank2_err;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1360 }
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1361 btcvsd->infra_misc_offset = offset[0];
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1362 btcvsd->conn_bt_cvsd_mask = offset[1];
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1363 btcvsd->cvsd_mcu_read_offset = offset[2];
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1364 btcvsd->cvsd_mcu_write_offset = offset[3];
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1365 btcvsd->cvsd_packet_indicator = offset[4];
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1366
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 @1367 btcvsd->bt_reg_pkt_r = btcvsd->bt_pkv_base +
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1368 btcvsd->cvsd_mcu_read_offset;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 @1369 btcvsd->bt_reg_pkt_w = btcvsd->bt_pkv_base +
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1370 btcvsd->cvsd_mcu_write_offset;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 @1371 btcvsd->bt_reg_ctl = btcvsd->bt_pkv_base +
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1372 btcvsd->cvsd_packet_indicator;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1373
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1374 /* init state */
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1375 mtk_btcvsd_snd_set_state(btcvsd, btcvsd->tx, BT_SCO_STATE_IDLE);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1376 mtk_btcvsd_snd_set_state(btcvsd, btcvsd->rx, BT_SCO_STATE_IDLE);
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1377
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1378 ret = devm_snd_soc_register_component(dev, &mtk_btcvsd_snd_platform,
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1379 NULL, 0);
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1380 if (ret)
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1381 goto unmap_bank2_err;
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1382
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1383 return 0;
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1384
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1385 unmap_bank2_err:
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1386 iounmap(btcvsd->bt_sram_bank2_base);
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1387 unmap_pkv_err:
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1388 iounmap(btcvsd->bt_pkv_base);
b6052c3c7a78f5e Christophe JAILLET 2021-06-06 1389 return ret;
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1390 }
4bd8597dc36c376 KaiChieh Chuang 2019-01-30 1391
:::::: The code at line 1367 was first introduced by commit
:::::: 4bd8597dc36c376a2bb1ef2c72984615bdeb68de ASoC: mediatek: add btcvsd driver
:::::: TO: KaiChieh Chuang <kaichieh.chuang@xxxxxxxxxxxx>
:::::: CC: Mark Brown <broonie@xxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx