tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS head: 773f731853f1368508a0b112047bd9b5a4bb9a5e commit: 5ebbfc8c29eb5eb6dfdab853bdb2a622e0533d7e [1358/1358] staging: TCM: add GMJS(Nationz Tech) TCM driver. config: arm64-randconfig-r123-20241228 (https://download.01.org/0day-ci/archive/20241229/202412290404.3HbuWdrq-lkp@i...) compiler: aarch64-linux-gcc (GCC) 14.2.0 reproduce: (https://download.01.org/0day-ci/archive/20241229/202412290404.3HbuWdrq-lkp@i...)
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@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202412290404.3HbuWdrq-lkp@intel.com/
sparse warnings: (new ones prefixed by >>) drivers/staging/gmjstcm/tcm_tis_spi.c:125:32: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *static [noderef] [toplevel] __iomem gpio1_a5 @@ drivers/staging/gmjstcm/tcm_tis_spi.c:125:32: sparse: expected void volatile [noderef] __iomem *addr drivers/staging/gmjstcm/tcm_tis_spi.c:125:32: sparse: got void *static [noderef] [toplevel] __iomem gpio1_a5 drivers/staging/gmjstcm/tcm_tis_spi.c:178:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *static [noderef] [toplevel] __iomem gpio1_a5 @@ drivers/staging/gmjstcm/tcm_tis_spi.c:178:33: sparse: expected void volatile [noderef] __iomem *addr drivers/staging/gmjstcm/tcm_tis_spi.c:178:33: sparse: got void *static [noderef] [toplevel] __iomem gpio1_a5 drivers/staging/gmjstcm/tcm_tis_spi.c:109:5: sparse: sparse: symbol 'tcm_tis_spi_transfer' was not declared. Should it be static? drivers/staging/gmjstcm/tcm_tis_spi.c:710:32: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *static [noderef] [toplevel] __iomem reuse_conf_reg @@ got void [noderef] __iomem * @@ drivers/staging/gmjstcm/tcm_tis_spi.c:710:32: sparse: expected void *static [noderef] [toplevel] __iomem reuse_conf_reg drivers/staging/gmjstcm/tcm_tis_spi.c:710:32: sparse: got void [noderef] __iomem * drivers/staging/gmjstcm/tcm_tis_spi.c:718:26: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *static [noderef] [toplevel] __iomem gpio1_a5 @@ got void [noderef] __iomem * @@ drivers/staging/gmjstcm/tcm_tis_spi.c:718:26: sparse: expected void *static [noderef] [toplevel] __iomem gpio1_a5 drivers/staging/gmjstcm/tcm_tis_spi.c:718:26: sparse: got void [noderef] __iomem * drivers/staging/gmjstcm/tcm_tis_spi.c:726:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got void *static [noderef] [toplevel] __iomem reuse_conf_reg @@ drivers/staging/gmjstcm/tcm_tis_spi.c:726:37: sparse: expected void const volatile [noderef] __iomem *addr drivers/staging/gmjstcm/tcm_tis_spi.c:726:37: sparse: got void *static [noderef] [toplevel] __iomem reuse_conf_reg
drivers/staging/gmjstcm/tcm_tis_spi.c:727:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *static [noderef] [toplevel] __iomem reuse_conf_reg @@
drivers/staging/gmjstcm/tcm_tis_spi.c:727:33: sparse: expected void volatile [noderef] __iomem *addr drivers/staging/gmjstcm/tcm_tis_spi.c:727:33: sparse: got void *static [noderef] [toplevel] __iomem reuse_conf_reg drivers/staging/gmjstcm/tcm_tis_spi.c:729:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@ drivers/staging/gmjstcm/tcm_tis_spi.c:729:42: sparse: expected void volatile [noderef] __iomem *addr drivers/staging/gmjstcm/tcm_tis_spi.c:729:42: sparse: got void * drivers/staging/gmjstcm/tcm_tis_spi.c:790:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *static [noderef] [toplevel] __iomem reuse_conf_reg @@ drivers/staging/gmjstcm/tcm_tis_spi.c:790:33: sparse: expected void volatile [noderef] __iomem *addr drivers/staging/gmjstcm/tcm_tis_spi.c:790:33: sparse: got void *static [noderef] [toplevel] __iomem reuse_conf_reg drivers/staging/gmjstcm/tcm_tis_spi.c:792:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *static [noderef] [toplevel] __iomem gpio1_a5 @@ drivers/staging/gmjstcm/tcm_tis_spi.c:792:33: sparse: expected void volatile [noderef] __iomem *addr drivers/staging/gmjstcm/tcm_tis_spi.c:792:33: sparse: got void *static [noderef] [toplevel] __iomem gpio1_a5 drivers/staging/gmjstcm/tcm_tis_spi.c:805:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *static [noderef] [toplevel] __iomem reuse_conf_reg @@ drivers/staging/gmjstcm/tcm_tis_spi.c:805:33: sparse: expected void volatile [noderef] __iomem *addr drivers/staging/gmjstcm/tcm_tis_spi.c:805:33: sparse: got void *static [noderef] [toplevel] __iomem reuse_conf_reg drivers/staging/gmjstcm/tcm_tis_spi.c:807:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *static [noderef] [toplevel] __iomem gpio1_a5 @@ drivers/staging/gmjstcm/tcm_tis_spi.c:807:33: sparse: expected void volatile [noderef] __iomem *addr drivers/staging/gmjstcm/tcm_tis_spi.c:807:33: sparse: got void *static [noderef] [toplevel] __iomem gpio1_a5 drivers/staging/gmjstcm/tcm_tis_spi.c:125:32: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:125:32: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:178:33: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:178:33: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:234:13: sparse: sparse: context imbalance in 'cleanup_tis' - wrong count at exit drivers/staging/gmjstcm/tcm_tis_spi.c:711:22: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:719:22: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:726:37: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:726:37: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:727:33: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:726:37: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:727:33: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:729:33: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:729:33: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:789:21: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:790:33: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:791:21: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:792:33: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:804:21: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:805:33: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:806:21: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:807:33: sparse: sparse: dereference of noderef expression drivers/staging/gmjstcm/tcm_tis_spi.c:109:5: warning: no previous prototype for 'tcm_tis_spi_transfer' [-Wmissing-prototypes] 109 | int tcm_tis_spi_transfer(struct device *dev, u32 addr, u16 len, | ^~~~~~~~~~~~~~~~~~~~ drivers/staging/gmjstcm/tcm_tis_spi.c: In function 'recv_data': drivers/staging/gmjstcm/tcm_tis_spi.c:423:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable] 423 | int ret; | ^~~ drivers/staging/gmjstcm/tcm_tis_spi.c: In function 'cleanup_tis': drivers/staging/gmjstcm/tcm_tis_spi.c:249:17: warning: 'inten' may be used uninitialized [-Wmaybe-uninitialized] 249 | tcm_tis_writel(chip->dev, TCM_INT_ENABLE(chip->vendor.locality), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 250 | ~TCM_GLOBAL_INT_ENABLE & inten); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/staging/gmjstcm/tcm_tis_spi.c:237:13: note: 'inten' was declared here 237 | u32 inten; | ^~~~~ drivers/staging/gmjstcm/tcm_tis_spi.c: In function 'tcm_tis_spi_probe': drivers/staging/gmjstcm/tcm_tis_spi.c:740:21: warning: 'vendor' may be used uninitialized [-Wmaybe-uninitialized] 740 | if ((vendor & 0xffff) != 0x19f5 && (vendor & 0xffff) != 0x1B4E) { | ~~~~~~~~^~~~~~~~~ drivers/staging/gmjstcm/tcm_tis_spi.c:658:13: note: 'vendor' was declared here 658 | u32 vendor, intfcaps; | ^~~~~~
vim +727 drivers/staging/gmjstcm/tcm_tis_spi.c
652 653 static struct tcm_chip *chip; 654 static int tcm_tis_spi_probe(struct spi_device *spi) 655 { 656 int ret; 657 u8 revid; 658 u32 vendor, intfcaps; 659 struct tcm_tis_spi_phy *phy; 660 struct chip_data *spi_chip; 661 662 pr_info("TCM(ky): __func__(v=%d) ..\n", 663 10); 664 665 tcm_dbg("TCM-dbg: %s/%d, enter\n", __func__, __LINE__); 666 phy = devm_kzalloc(&spi->dev, sizeof(struct tcm_tis_spi_phy), 667 GFP_KERNEL); 668 if (!phy) 669 return -ENOMEM; 670 671 phy->iobuf = devm_kmalloc(&spi->dev, MAX_SPI_FRAMESIZE, GFP_KERNEL); 672 if (!phy->iobuf) 673 return -ENOMEM; 674 675 phy->spi_device = spi; 676 init_completion(&phy->ready); 677 678 tcm_dbg("TCM-dbg: %s/%d\n", __func__, __LINE__); 679 /* init spi dev */ 680 spi->chip_select = 0; /* cs0 */ 681 spi->mode = SPI_MODE_0; 682 spi->bits_per_word = 8; 683 spi->max_speed_hz = spi->max_speed_hz ? : 24000000; 684 spi_setup(spi); 685 686 spi_chip = spi_get_ctldata(spi); 687 if (!spi_chip) { 688 pr_err("There was wrong in spi master\n"); 689 return -ENODEV; 690 } 691 /* tcm does not support interrupt mode, we use poll mode instead. */ 692 spi_chip->poll_mode = 1; 693 694 tcm_dbg("TCM-dbg: %s/%d\n", __func__, __LINE__); 695 /* regiter tcm hw */ 696 chip = tcm_register_hardware(&spi->dev, &tcm_tis); 697 if (!chip) { 698 dev_err(chip->dev, "tcm register hardware err\n"); 699 return -ENODEV; 700 } 701 702 dev_set_drvdata(chip->dev, phy); 703 704 /** 705 * phytium2000a4 spi controller's clk clk level is unstable, 706 * so it is solved by using the low level of gpio output. 707 **/ 708 if (is_ft_all() && (spi->chip_select == 0)) { 709 /* reuse conf reg base */ 710 reuse_conf_reg = ioremap(REUSE_CONF_REG_BASE, 0x10); 711 if (!reuse_conf_reg) { 712 dev_err(&spi->dev, "Failed to ioremap reuse conf reg\n"); 713 ret = -ENOMEM; 714 goto out_err; 715 } 716 717 /* gpio1 a5 base addr */ 718 gpio1_a5 = ioremap(REUSE_GPIO1_A5_BASE, 0x10); 719 if (!gpio1_a5) { 720 dev_err(&spi->dev, "Failed to ioremap gpio1 a5\n"); 721 ret = -ENOMEM; 722 goto out_err; 723 } 724 725 /* reuse cs0 to gpio1_a5 */ 726 iowrite32((ioread32(reuse_conf_reg) | 0xFFFF0) & 0xFFF9004F,
727 reuse_conf_reg);
728 /* set gpio1 a5 to output */ 729 iowrite32(0x20, gpio1_a5 + 0x4); 730 } 731 732 tcm_dbg("TCM-dbg: %s/%d\n", 733 __func__, __LINE__); 734 ret = tcm_tis_readl(chip->dev, TCM_DID_VID(0), &vendor); 735 if (ret < 0) 736 goto out_err; 737 738 tcm_dbg("TCM-dbg: %s/%d, vendor: 0x%x\n", 739 __func__, __LINE__, vendor); 740 if ((vendor & 0xffff) != 0x19f5 && (vendor & 0xffff) != 0x1B4E) { 741 dev_err(chip->dev, "there is no Nationz TCM on you computer\n"); 742 goto out_err; 743 } 744 745 ret = tcm_tis_readb(chip->dev, TCM_RID(0), &revid); 746 tcm_dbg("TCM-dbg: %s/%d, revid: 0x%x\n", 747 __func__, __LINE__, revid); 748 if (ret < 0) 749 goto out_err; 750 dev_info(chip->dev, "kylin: 2019-09-21 1.2 TCM " 751 "(device-id 0x%X, rev-id %d)\n", 752 vendor >> 16, revid); 753 754 /* Default timeouts */ 755 chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT); 756 chip->vendor.timeout_b = msecs_to_jiffies(TIS_LONG_TIMEOUT); 757 chip->vendor.timeout_c = msecs_to_jiffies(TIS_SHORT_TIMEOUT); 758 chip->vendor.timeout_d = msecs_to_jiffies(TIS_SHORT_TIMEOUT); 759 760 tcm_dbg("TCM-dbg: %s/%d\n", 761 __func__, __LINE__); 762 /* Figure out the capabilities */ 763 ret = tcm_tis_readl(chip->dev, 764 TCM_INTF_CAPS(chip->vendor.locality), &intfcaps); 765 if (ret < 0) 766 goto out_err; 767 768 tcm_dbg("TCM-dbg: %s/%d, intfcaps: 0x%x\n", 769 __func__, __LINE__, intfcaps); 770 if (request_locality(chip, 0) != 0) { 771 dev_err(chip->dev, "tcm request_locality err\n"); 772 ret = -ENODEV; 773 goto out_err; 774 } 775 776 INIT_LIST_HEAD(&chip->vendor.list); 777 spin_lock(&tis_lock); 778 list_add(&chip->vendor.list, &tis_chips); 779 spin_unlock(&tis_lock); 780 781 tcm_get_timeouts(chip); 782 tcm_startup(chip); 783 784 tcm_dbg("TCM-dbg: %s/%d, exit\n", __func__, __LINE__); 785 return 0; 786 787 out_err: 788 if (is_ft_all()) { 789 if (reuse_conf_reg) 790 iounmap(reuse_conf_reg); 791 if (gpio1_a5) 792 iounmap(gpio1_a5); 793 } 794 tcm_dbg("TCM-dbg: %s/%d, error\n", __func__, __LINE__); 795 dev_set_drvdata(chip->dev, chip); 796 tcm_remove_hardware(chip->dev); 797 798 return ret; 799 } 800