drivers/mmc/host/s3cmci.c:1684:21: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Fri Dec 25 2020 - 17:00:42 EST


Hi Krzysztof,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5814bc2d4cc241c1a603fac2b5bf1bd4daa108fc
commit: 1b0e4a2141c7bf6a122f1e04cbc1690b835707cf mmc: s3cmci: enable compile testing
date: 6 weeks ago
config: openrisc-randconfig-s031-20201223 (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.3-184-g1b896707-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1b0e4a2141c7bf6a122f1e04cbc1690b835707cf
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 1b0e4a2141c7bf6a122f1e04cbc1690b835707cf
# 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/mmc/host/s3cmci.c:1684:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *base @@
drivers/mmc/host/s3cmci.c:1684:21: sparse: expected void *addr
drivers/mmc/host/s3cmci.c:1684:21: sparse: got void [noderef] __iomem *base
drivers/mmc/host/s3cmci.c:1726:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *base @@
drivers/mmc/host/s3cmci.c:1726:21: sparse: expected void *addr
drivers/mmc/host/s3cmci.c:1726:21: sparse: got void [noderef] __iomem *base

vim +1684 drivers/mmc/host/s3cmci.c

e584e07502131fb Sergio Prado 2017-03-31 1507
e584e07502131fb Sergio Prado 2017-03-31 1508 static int s3cmci_probe(struct platform_device *pdev)
e584e07502131fb Sergio Prado 2017-03-31 1509 {
e584e07502131fb Sergio Prado 2017-03-31 1510 struct s3cmci_host *host;
e584e07502131fb Sergio Prado 2017-03-31 1511 struct mmc_host *mmc;
e584e07502131fb Sergio Prado 2017-03-31 1512 int ret;
e584e07502131fb Sergio Prado 2017-03-31 1513
e584e07502131fb Sergio Prado 2017-03-31 1514 mmc = mmc_alloc_host(sizeof(struct s3cmci_host), &pdev->dev);
e584e07502131fb Sergio Prado 2017-03-31 1515 if (!mmc) {
e584e07502131fb Sergio Prado 2017-03-31 1516 ret = -ENOMEM;
e584e07502131fb Sergio Prado 2017-03-31 1517 goto probe_out;
916a30775fc843e Ben Dooks 2009-10-01 1518 }
916a30775fc843e Ben Dooks 2009-10-01 1519
be518018c6b9224 Thomas Kleffel 2008-06-30 1520 host = mmc_priv(mmc);
be518018c6b9224 Thomas Kleffel 2008-06-30 1521 host->mmc = mmc;
be518018c6b9224 Thomas Kleffel 2008-06-30 1522 host->pdev = pdev;
e584e07502131fb Sergio Prado 2017-03-31 1523
e584e07502131fb Sergio Prado 2017-03-31 1524 if (pdev->dev.of_node)
e584e07502131fb Sergio Prado 2017-03-31 1525 ret = s3cmci_probe_dt(host);
e584e07502131fb Sergio Prado 2017-03-31 1526 else
e584e07502131fb Sergio Prado 2017-03-31 1527 ret = s3cmci_probe_pdata(host);
e584e07502131fb Sergio Prado 2017-03-31 1528
e584e07502131fb Sergio Prado 2017-03-31 1529 if (ret)
e584e07502131fb Sergio Prado 2017-03-31 1530 goto probe_free_host;
be518018c6b9224 Thomas Kleffel 2008-06-30 1531
edb5a98e43682d6 Ben Dooks 2008-06-30 1532 host->pdata = pdev->dev.platform_data;
edb5a98e43682d6 Ben Dooks 2008-06-30 1533
be518018c6b9224 Thomas Kleffel 2008-06-30 1534 spin_lock_init(&host->complete_lock);
be518018c6b9224 Thomas Kleffel 2008-06-30 1535 tasklet_init(&host->pio_tasklet, pio_tasklet, (unsigned long) host);
be518018c6b9224 Thomas Kleffel 2008-06-30 1536
e584e07502131fb Sergio Prado 2017-03-31 1537 if (host->is2440) {
be518018c6b9224 Thomas Kleffel 2008-06-30 1538 host->sdiimsk = S3C2440_SDIIMSK;
be518018c6b9224 Thomas Kleffel 2008-06-30 1539 host->sdidata = S3C2440_SDIDATA;
be518018c6b9224 Thomas Kleffel 2008-06-30 1540 host->clk_div = 1;
be518018c6b9224 Thomas Kleffel 2008-06-30 1541 } else {
be518018c6b9224 Thomas Kleffel 2008-06-30 1542 host->sdiimsk = S3C2410_SDIIMSK;
be518018c6b9224 Thomas Kleffel 2008-06-30 1543 host->sdidata = S3C2410_SDIDATA;
be518018c6b9224 Thomas Kleffel 2008-06-30 1544 host->clk_div = 2;
be518018c6b9224 Thomas Kleffel 2008-06-30 1545 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1546
be518018c6b9224 Thomas Kleffel 2008-06-30 1547 host->complete_what = COMPLETION_NONE;
be518018c6b9224 Thomas Kleffel 2008-06-30 1548 host->pio_active = XFER_NONE;
be518018c6b9224 Thomas Kleffel 2008-06-30 1549
be518018c6b9224 Thomas Kleffel 2008-06-30 1550 host->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
be518018c6b9224 Thomas Kleffel 2008-06-30 1551 if (!host->mem) {
be518018c6b9224 Thomas Kleffel 2008-06-30 1552 dev_err(&pdev->dev,
4aa6ded9fa72a58 Masanari Iida 2012-01-29 1553 "failed to get io memory region resource.\n");
be518018c6b9224 Thomas Kleffel 2008-06-30 1554
be518018c6b9224 Thomas Kleffel 2008-06-30 1555 ret = -ENOENT;
f67f6c00c7f367f Arnd Bergmann 2020-08-06 1556 goto probe_free_host;
be518018c6b9224 Thomas Kleffel 2008-06-30 1557 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1558
be518018c6b9224 Thomas Kleffel 2008-06-30 1559 host->mem = request_mem_region(host->mem->start,
da52a7ca7a68971 Ben Dooks 2009-10-01 1560 resource_size(host->mem), pdev->name);
be518018c6b9224 Thomas Kleffel 2008-06-30 1561
be518018c6b9224 Thomas Kleffel 2008-06-30 1562 if (!host->mem) {
be518018c6b9224 Thomas Kleffel 2008-06-30 1563 dev_err(&pdev->dev, "failed to request io memory region.\n");
be518018c6b9224 Thomas Kleffel 2008-06-30 1564 ret = -ENOENT;
f67f6c00c7f367f Arnd Bergmann 2020-08-06 1565 goto probe_free_host;
be518018c6b9224 Thomas Kleffel 2008-06-30 1566 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1567
da52a7ca7a68971 Ben Dooks 2009-10-01 1568 host->base = ioremap(host->mem->start, resource_size(host->mem));
5d304400a9a867a Ben Dooks 2008-08-08 1569 if (!host->base) {
be518018c6b9224 Thomas Kleffel 2008-06-30 1570 dev_err(&pdev->dev, "failed to ioremap() io memory region.\n");
be518018c6b9224 Thomas Kleffel 2008-06-30 1571 ret = -EINVAL;
be518018c6b9224 Thomas Kleffel 2008-06-30 1572 goto probe_free_mem_region;
be518018c6b9224 Thomas Kleffel 2008-06-30 1573 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1574
be518018c6b9224 Thomas Kleffel 2008-06-30 1575 host->irq = platform_get_irq(pdev, 0);
928635c114adefc Arvind Yadav 2017-11-19 1576 if (host->irq <= 0) {
be518018c6b9224 Thomas Kleffel 2008-06-30 1577 ret = -EINVAL;
be518018c6b9224 Thomas Kleffel 2008-06-30 1578 goto probe_iounmap;
be518018c6b9224 Thomas Kleffel 2008-06-30 1579 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1580
be518018c6b9224 Thomas Kleffel 2008-06-30 1581 if (request_irq(host->irq, s3cmci_irq, 0, DRIVER_NAME, host)) {
be518018c6b9224 Thomas Kleffel 2008-06-30 1582 dev_err(&pdev->dev, "failed to request mci interrupt.\n");
be518018c6b9224 Thomas Kleffel 2008-06-30 1583 ret = -ENOENT;
be518018c6b9224 Thomas Kleffel 2008-06-30 1584 goto probe_iounmap;
be518018c6b9224 Thomas Kleffel 2008-06-30 1585 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1586
be518018c6b9224 Thomas Kleffel 2008-06-30 1587 /* We get spurious interrupts even when we have set the IMSK
be518018c6b9224 Thomas Kleffel 2008-06-30 1588 * register to ignore everything, so use disable_irq() to make
be518018c6b9224 Thomas Kleffel 2008-06-30 1589 * ensure we don't lock the system with un-serviceable requests. */
be518018c6b9224 Thomas Kleffel 2008-06-30 1590
be518018c6b9224 Thomas Kleffel 2008-06-30 1591 disable_irq(host->irq);
c225889375fea2a Ben Dooks 2009-10-01 1592 host->irq_state = false;
be518018c6b9224 Thomas Kleffel 2008-06-30 1593
18fae5c45c4ba3c Sylwester Nawrocki 2016-10-26 1594 /* Depending on the dma state, get a DMA channel to use. */
68c5ed592fdae16 Ben Dooks 2009-10-01 1595
68c5ed592fdae16 Ben Dooks 2009-10-01 1596 if (s3cmci_host_usedma(host)) {
18fae5c45c4ba3c Sylwester Nawrocki 2016-10-26 1597 host->dma = dma_request_chan(&pdev->dev, "rx-tx");
18fae5c45c4ba3c Sylwester Nawrocki 2016-10-26 1598 ret = PTR_ERR_OR_ZERO(host->dma);
18fae5c45c4ba3c Sylwester Nawrocki 2016-10-26 1599 if (ret) {
68c5ed592fdae16 Ben Dooks 2009-10-01 1600 dev_err(&pdev->dev, "cannot get DMA channel.\n");
e584e07502131fb Sergio Prado 2017-03-31 1601 goto probe_free_irq;
68c5ed592fdae16 Ben Dooks 2009-10-01 1602 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1603 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1604
be518018c6b9224 Thomas Kleffel 2008-06-30 1605 host->clk = clk_get(&pdev->dev, "sdi");
be518018c6b9224 Thomas Kleffel 2008-06-30 1606 if (IS_ERR(host->clk)) {
be518018c6b9224 Thomas Kleffel 2008-06-30 1607 dev_err(&pdev->dev, "failed to find clock source.\n");
be518018c6b9224 Thomas Kleffel 2008-06-30 1608 ret = PTR_ERR(host->clk);
be518018c6b9224 Thomas Kleffel 2008-06-30 1609 host->clk = NULL;
68c5ed592fdae16 Ben Dooks 2009-10-01 1610 goto probe_free_dma;
be518018c6b9224 Thomas Kleffel 2008-06-30 1611 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1612
d222c4c0ce170cd Vasily Khoruzhick 2014-06-30 1613 ret = clk_prepare_enable(host->clk);
be518018c6b9224 Thomas Kleffel 2008-06-30 1614 if (ret) {
be518018c6b9224 Thomas Kleffel 2008-06-30 1615 dev_err(&pdev->dev, "failed to enable clock source.\n");
be518018c6b9224 Thomas Kleffel 2008-06-30 1616 goto clk_free;
be518018c6b9224 Thomas Kleffel 2008-06-30 1617 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1618
be518018c6b9224 Thomas Kleffel 2008-06-30 1619 host->clk_rate = clk_get_rate(host->clk);
be518018c6b9224 Thomas Kleffel 2008-06-30 1620
be518018c6b9224 Thomas Kleffel 2008-06-30 1621 mmc->ops = &s3cmci_ops;
edb5a98e43682d6 Ben Dooks 2008-06-30 1622 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
5a2c4fe04dca1ee Ben Dooks 2009-10-01 1623 #ifdef CONFIG_MMC_S3C_HW_SDIO_IRQ
c225889375fea2a Ben Dooks 2009-10-01 1624 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ;
5a2c4fe04dca1ee Ben Dooks 2009-10-01 1625 #else
5a2c4fe04dca1ee Ben Dooks 2009-10-01 1626 mmc->caps = MMC_CAP_4_BIT_DATA;
5a2c4fe04dca1ee Ben Dooks 2009-10-01 1627 #endif
be518018c6b9224 Thomas Kleffel 2008-06-30 1628 mmc->f_min = host->clk_rate / (host->clk_div * 256);
be518018c6b9224 Thomas Kleffel 2008-06-30 1629 mmc->f_max = host->clk_rate / host->clk_div;
be518018c6b9224 Thomas Kleffel 2008-06-30 1630
edb5a98e43682d6 Ben Dooks 2008-06-30 1631 if (host->pdata->ocr_avail)
edb5a98e43682d6 Ben Dooks 2008-06-30 1632 mmc->ocr_avail = host->pdata->ocr_avail;
edb5a98e43682d6 Ben Dooks 2008-06-30 1633
be518018c6b9224 Thomas Kleffel 2008-06-30 1634 mmc->max_blk_count = 4095;
be518018c6b9224 Thomas Kleffel 2008-06-30 1635 mmc->max_blk_size = 4095;
be518018c6b9224 Thomas Kleffel 2008-06-30 1636 mmc->max_req_size = 4095 * 512;
be518018c6b9224 Thomas Kleffel 2008-06-30 1637 mmc->max_seg_size = mmc->max_req_size;
be518018c6b9224 Thomas Kleffel 2008-06-30 1638
a36274e0184193e Martin K. Petersen 2010-09-10 1639 mmc->max_segs = 128;
be518018c6b9224 Thomas Kleffel 2008-06-30 1640
be518018c6b9224 Thomas Kleffel 2008-06-30 1641 dbg(host, dbg_debug,
b45e4b5093298e5 Vasily Khoruzhick 2014-06-01 1642 "probe: mode:%s mapped mci_base:%p irq:%u irq_cd:%u dma:%p.\n",
be518018c6b9224 Thomas Kleffel 2008-06-30 1643 (host->is2440?"2440":""),
be518018c6b9224 Thomas Kleffel 2008-06-30 1644 host->base, host->irq, host->irq_cd, host->dma);
be518018c6b9224 Thomas Kleffel 2008-06-30 1645
f87e6d00fbd367f ben@xxxxxxxxxxxx 2008-10-15 1646 ret = s3cmci_cpufreq_register(host);
f87e6d00fbd367f ben@xxxxxxxxxxxx 2008-10-15 1647 if (ret) {
f87e6d00fbd367f ben@xxxxxxxxxxxx 2008-10-15 1648 dev_err(&pdev->dev, "failed to register cpufreq\n");
f87e6d00fbd367f ben@xxxxxxxxxxxx 2008-10-15 1649 goto free_dmabuf;
f87e6d00fbd367f ben@xxxxxxxxxxxx 2008-10-15 1650 }
f87e6d00fbd367f ben@xxxxxxxxxxxx 2008-10-15 1651
be518018c6b9224 Thomas Kleffel 2008-06-30 1652 ret = mmc_add_host(mmc);
be518018c6b9224 Thomas Kleffel 2008-06-30 1653 if (ret) {
be518018c6b9224 Thomas Kleffel 2008-06-30 1654 dev_err(&pdev->dev, "failed to add mmc host.\n");
f87e6d00fbd367f ben@xxxxxxxxxxxx 2008-10-15 1655 goto free_cpufreq;
be518018c6b9224 Thomas Kleffel 2008-06-30 1656 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1657
9bdd203b4dc82e9 Ben Dooks 2009-10-01 1658 s3cmci_debugfs_attach(host);
9bdd203b4dc82e9 Ben Dooks 2009-10-01 1659
be518018c6b9224 Thomas Kleffel 2008-06-30 1660 platform_set_drvdata(pdev, mmc);
5a2c4fe04dca1ee Ben Dooks 2009-10-01 1661 dev_info(&pdev->dev, "%s - using %s, %s SDIO IRQ\n", mmc_hostname(mmc),
5a2c4fe04dca1ee Ben Dooks 2009-10-01 1662 s3cmci_host_usedma(host) ? "dma" : "pio",
5a2c4fe04dca1ee Ben Dooks 2009-10-01 1663 mmc->caps & MMC_CAP_SDIO_IRQ ? "hw" : "sw");
be518018c6b9224 Thomas Kleffel 2008-06-30 1664
be518018c6b9224 Thomas Kleffel 2008-06-30 1665 return 0;
be518018c6b9224 Thomas Kleffel 2008-06-30 1666
f87e6d00fbd367f ben@xxxxxxxxxxxx 2008-10-15 1667 free_cpufreq:
f87e6d00fbd367f ben@xxxxxxxxxxxx 2008-10-15 1668 s3cmci_cpufreq_deregister(host);
f87e6d00fbd367f ben@xxxxxxxxxxxx 2008-10-15 1669
be518018c6b9224 Thomas Kleffel 2008-06-30 1670 free_dmabuf:
d222c4c0ce170cd Vasily Khoruzhick 2014-06-30 1671 clk_disable_unprepare(host->clk);
be518018c6b9224 Thomas Kleffel 2008-06-30 1672
be518018c6b9224 Thomas Kleffel 2008-06-30 1673 clk_free:
be518018c6b9224 Thomas Kleffel 2008-06-30 1674 clk_put(host->clk);
be518018c6b9224 Thomas Kleffel 2008-06-30 1675
68c5ed592fdae16 Ben Dooks 2009-10-01 1676 probe_free_dma:
68c5ed592fdae16 Ben Dooks 2009-10-01 1677 if (s3cmci_host_usedma(host))
b45e4b5093298e5 Vasily Khoruzhick 2014-06-01 1678 dma_release_channel(host->dma);
68c5ed592fdae16 Ben Dooks 2009-10-01 1679
be518018c6b9224 Thomas Kleffel 2008-06-30 1680 probe_free_irq:
be518018c6b9224 Thomas Kleffel 2008-06-30 1681 free_irq(host->irq, host);
be518018c6b9224 Thomas Kleffel 2008-06-30 1682
be518018c6b9224 Thomas Kleffel 2008-06-30 1683 probe_iounmap:
be518018c6b9224 Thomas Kleffel 2008-06-30 @1684 iounmap(host->base);
be518018c6b9224 Thomas Kleffel 2008-06-30 1685
be518018c6b9224 Thomas Kleffel 2008-06-30 1686 probe_free_mem_region:
da52a7ca7a68971 Ben Dooks 2009-10-01 1687 release_mem_region(host->mem->start, resource_size(host->mem));
be518018c6b9224 Thomas Kleffel 2008-06-30 1688
be518018c6b9224 Thomas Kleffel 2008-06-30 1689 probe_free_host:
be518018c6b9224 Thomas Kleffel 2008-06-30 1690 mmc_free_host(mmc);
916a30775fc843e Ben Dooks 2009-10-01 1691
be518018c6b9224 Thomas Kleffel 2008-06-30 1692 probe_out:
be518018c6b9224 Thomas Kleffel 2008-06-30 1693 return ret;
be518018c6b9224 Thomas Kleffel 2008-06-30 1694 }
be518018c6b9224 Thomas Kleffel 2008-06-30 1695

:::::: The code at line 1684 was first introduced by commit
:::::: be518018c6b9224c02284fb243207ef741c31ec6 MMC: S3C24XX MMC/SD driver.

:::::: TO: Thomas Kleffel <tk@xxxxxxxxxxx>
:::::: CC: Pierre Ossman <drzeus@xxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip