Skip to contentSkip to conversation

sound/isa/sc6000.c:534:35: sparse: sparse: incorrect type in initializer (different address spaces)

PATCH kernel test robot 1 participant 1 message Jul 20, 2021

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
head:   9b7843d1e125dca0d6ed0af9e8dd709d41eb25ad
commit: 9b7843d1e125dca0d6ed0af9e8dd709d41eb25ad [92/92] ALSA: sc6000: Assign vport directly on card's private_data
config: x86_64-randconfig-s021-20210718 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?id=9b7843d1e125dca0d6ed0af9e8dd709d41eb25ad
        git remote add sound https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
        git fetch --no-tags sound for-next
        git checkout 9b7843d1e125dca0d6ed0af9e8dd709d41eb25ad
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

sparse warnings: (new ones prefixed by >>)

>> sound/isa/sc6000.c:534:35: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char [noderef] __iomem *vport @@     got void *private_data @@
   sound/isa/sc6000.c:534:35: sparse:     expected char [noderef] __iomem *vport
   sound/isa/sc6000.c:534:35: sparse:     got void *private_data
>> sound/isa/sc6000.c:585:28: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *private_data @@     got char [noderef] __iomem *[assigned] vport @@

sound/isa/sc6000.c:585:28: sparse: expected void *private_data
sound/isa/sc6000.c:585:28: sparse: got char [noderef] __iomem *[assigned] vport

vim +534 sound/isa/sc6000.c

531
532 static void snd_sc6000_free(struct snd_card *card)
533 {

 > 534		char __iomem *vport = card->private_data;
   535	
   536		if (vport)
   537			sc6000_setup_board(vport, 0);
   538	}
   539	
   540	static int snd_sc6000_probe(struct device *devptr, unsigned int dev)
   541	{
   542		static const int possible_irqs[] = { 5, 7, 9, 10, 11, -1 };
   543		static const int possible_dmas[] = { 1, 3, 0, -1 };
   544		int err;
   545		int xirq = irq[dev];
   546		int xdma = dma[dev];
   547		struct snd_card *card;
   548		struct snd_wss *chip;
   549		struct snd_opl3 *opl3;
   550		char __iomem *vport;
   551		char __iomem *vmss_port;
   552	
   553		err = snd_devm_card_new(devptr, index[dev], id[dev], THIS_MODULE,
   554					0, &card);
   555		if (err < 0)
   556			return err;
   557	
   558		if (xirq == SNDRV_AUTO_IRQ) {
   559			xirq = snd_legacy_find_free_irq(possible_irqs);
   560			if (xirq < 0) {
   561				snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
   562				return -EBUSY;
   563			}
   564		}
   565	
   566		if (xdma == SNDRV_AUTO_DMA) {
   567			xdma = snd_legacy_find_free_dma(possible_dmas);
   568			if (xdma < 0) {
   569				snd_printk(KERN_ERR PFX "unable to find a free DMA\n");
   570				return -EBUSY;
   571			}
   572		}
   573	
   574		if (!devm_request_region(devptr, port[dev], 0x10, DRV_NAME)) {
   575			snd_printk(KERN_ERR PFX
   576				   "I/O port region is already in use.\n");
   577			return -EBUSY;
   578		}
   579		vport = devm_ioport_map(devptr, port[dev], 0x10);
   580		if (!vport) {
   581			snd_printk(KERN_ERR PFX
   582				   "I/O port cannot be iomapped.\n");
   583			return -EBUSY;
   584		}
 > 585		card->private_data = vport;

586
587 /* to make it marked as used */
588 if (!devm_request_region(devptr, mss_port[dev], 4, DRV_NAME)) {
589 snd_printk(KERN_ERR PFX
590 "SC-6000 port I/O port region is already in use.\n");
591 return -EBUSY;
592 }
593 vmss_port = devm_ioport_map(devptr, mss_port[dev], 4);
594 if (!vmss_port) {
595 snd_printk(KERN_ERR PFX
596 "MSS port I/O cannot be iomapped.\n");
597 return -EBUSY;
598 }
599
600 snd_printd("Initializing BASE[0x%lx] IRQ[%d] DMA[%d] MIRQ[%d]\n",
601 port[dev], xirq, xdma,
602 mpu_irq[dev] == SNDRV_AUTO_IRQ ? 0 : mpu_irq[dev]);
603
604 err = sc6000_init_board(vport, vmss_port, dev);
605 if (err < 0)
606 return err;
607 card->private_free = snd_sc6000_free;
608
609 err = snd_wss_create(card, mss_port[dev] + 4, -1, xirq, xdma, -1,
610 WSS_HW_DETECT, 0, &chip);
611 if (err < 0)
612 return err;
613
614 err = snd_wss_pcm(chip, 0);
615 if (err < 0) {
616 snd_printk(KERN_ERR PFX
617 "error creating new WSS PCM device\n");
618 return err;
619 }
620 err = snd_wss_mixer(chip);
621 if (err < 0) {
622 snd_printk(KERN_ERR PFX "error creating new WSS mixer\n");
623 return err;
624 }
625 err = snd_sc6000_mixer(chip);
626 if (err < 0) {
627 snd_printk(KERN_ERR PFX "the mixer rewrite failed\n");
628 return err;
629 }
630 if (snd_opl3_create(card,
631 0x388, 0x388 + 2,
632 OPL3_HW_AUTO, 0, &opl3) < 0) {
633 snd_printk(KERN_ERR PFX "no OPL device at 0x%x-0x%x ?\n",
634 0x388, 0x388 + 2);
635 } else {
636 err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
637 if (err < 0)
638 return err;
639 }
640
641 if (mpu_port[dev] != SNDRV_AUTO_PORT) {
642 if (mpu_irq[dev] == SNDRV_AUTO_IRQ)
643 mpu_irq[dev] = -1;
644 if (snd_mpu401_uart_new(card, 0,
645 MPU401_HW_MPU401,
646 mpu_port[dev], 0,
647 mpu_irq[dev], NULL) < 0)
648 snd_printk(KERN_ERR "no MPU-401 device@0x%lx ?\n",
649 mpu_port[dev]);
650 }
651
652 strcpy(card->driver, DRV_NAME);
653 strcpy(card->shortname, "SC-6000");
654 sprintf(card->longname, "Gallant SC-6000 at 0x%lx, irq %d, dma %d",
655 mss_port[dev], xirq, xdma);
656
657 err = snd_card_register(card);
658 if (err < 0)
659 return err;
660
661 dev_set_drvdata(devptr, card);
662 return 0;
663 }
664

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]