All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 1797/8629] drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types)
@ 2020-09-17 21:09 kernel test robot
  2020-09-18  8:10 ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2020-09-17 21:09 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 9829 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   860461e4fcaa76200d2d1a53523e0ff7be92e6e8
commit: 98c2922ec8f0601321428be8c59ae1df255478d1 [1797/8629] ARM: s3c24xx: simplify mach/io.h
config: arm-randconfig-s031-20200917 (attached as .config)
compiler: arm-linux-gnueabi-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.2-201-g24bdaac6-dirty
        git checkout 98c2922ec8f0601321428be8c59ae1df255478d1
        # 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=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

   drivers/tty/ipwireless/hardware.c:431:25: sparse: sparse: cast from restricted __le16
   drivers/tty/ipwireless/hardware.c:445:25: sparse: sparse: cast from restricted __le16
>> drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le16 [usertype] raw_data @@     got unsigned short [usertype] __v @@
   drivers/tty/ipwireless/hardware.c:872:43: sparse:     expected restricted __le16 [usertype] raw_data
>> drivers/tty/ipwireless/hardware.c:872:43: sparse:     got unsigned short [usertype] __v
   drivers/tty/ipwireless/hardware.c:889:43: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le16 [usertype] raw_data @@     got unsigned short [usertype] __v @@
   drivers/tty/ipwireless/hardware.c:889:43: sparse:     expected restricted __le16 [usertype] raw_data
   drivers/tty/ipwireless/hardware.c:889:43: sparse:     got unsigned short [usertype] __v

# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=98c2922ec8f0601321428be8c59ae1df255478d1
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 98c2922ec8f0601321428be8c59ae1df255478d1
vim +872 drivers/tty/ipwireless/hardware.c

099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  850  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  851  /*
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  852   * Retrieve a packet from the IPW hardware.
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  853   */
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  854  static void do_receive_packet(struct ipw_hardware *hw)
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  855  {
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  856  	unsigned len;
d4c0deb7009217 drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28  857  	unsigned i;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  858  	unsigned char pkt[LL_MTU_MAX];
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  859  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  860  	start_timing();
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  861  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  862  	if (hw->hw_version == HW_VERSION_1) {
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  863  		len = inw(hw->base_port + IODRR);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  864  		if (len > hw->ll_mtu) {
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  865  			printk(KERN_INFO IPWIRELESS_PCCARD_NAME
622e713e8e207a drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28  866  			       ": received a packet of %u bytes - longer than the MTU!\n", len);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  867  			outw(DCR_RXDONE | DCR_RXRESET, hw->base_port + IODCR);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  868  			return;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  869  		}
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  870  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  871  		for (i = 0; i < len; i += 2) {
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07 @872  			__le16 raw_data = inw(hw->base_port + IODRR);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  873  			unsigned short data = le16_to_cpu(raw_data);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  874  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  875  			pkt[i] = (unsigned char) data;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  876  			pkt[i + 1] = (unsigned char) (data >> 8);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  877  		}
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  878  	} else {
2e713165f892c8 drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28  879  		len = inw(hw->base_port);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  880  		if (len > hw->ll_mtu) {
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  881  			printk(KERN_INFO IPWIRELESS_PCCARD_NAME
622e713e8e207a drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28  882  			       ": received a packet of %u bytes - longer than the MTU!\n", len);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  883  			writew(MEMRX_PCINTACKK,
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  884  				&hw->memory_info_regs->memreg_pc_interrupt_ack);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  885  			return;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  886  		}
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  887  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  888  		for (i = 0; i < len; i += 2) {
2e713165f892c8 drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28  889  			__le16 raw_data = inw(hw->base_port);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  890  			unsigned short data = le16_to_cpu(raw_data);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  891  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  892  			pkt[i] = (unsigned char) data;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  893  			pkt[i + 1] = (unsigned char) (data >> 8);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  894  		}
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  895  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  896  		while ((i & 3) != 2) {
2e713165f892c8 drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28  897  			inw(hw->base_port);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  898  			i += 2;
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  899  		}
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  900  	}
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  901  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  902  	acknowledge_data_read(hw);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  903  
d54c2752f6bb6c drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28  904  	swap_packet_bitfield_from_le(pkt);
d54c2752f6bb6c drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-07-28  905  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  906  	if (ipwireless_debug)
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  907  		dump_data_bytes("recv", pkt, len);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  908  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  909  	handle_received_packet(hw, (union nl_packet *) pkt, len);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  910  
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  911  	end_read_timing(len);
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  912  }
099dc4fb62653f drivers/char/pcmcia/ipwireless/hardware.c David Sterba 2008-02-07  913  

:::::: The code at line 872 was first introduced by commit
:::::: 099dc4fb62653f6019d78db55fba7a18ef02d65b ipwireless: driver for PC Card 3G/UMTS modem

:::::: TO: David Sterba <dsterba@suse.cz>
:::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 28793 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 1797/8629] drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types)
  2020-09-17 21:09 [linux-next:master 1797/8629] drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types) kernel test robot
@ 2020-09-18  8:10 ` Arnd Bergmann
  2020-09-18  8:37   ` Krzysztof Kozlowski
  2020-09-18 13:50   ` David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2020-09-18  8:10 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3055 bytes --]

On Thu, Sep 17, 2020 at 11:10 PM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   860461e4fcaa76200d2d1a53523e0ff7be92e6e8
> commit: 98c2922ec8f0601321428be8c59ae1df255478d1 [1797/8629] ARM: s3c24xx: simplify mach/io.h
> config: arm-randconfig-s031-20200917 (attached as .config)
> compiler: arm-linux-gnueabi-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.2-201-g24bdaac6-dirty
>         git checkout 98c2922ec8f0601321428be8c59ae1df255478d1
>         # 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=arm
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> sparse warnings: (new ones prefixed by >>)
>
>    drivers/tty/ipwireless/hardware.c:431:25: sparse: sparse: cast from restricted __le16
>    drivers/tty/ipwireless/hardware.c:445:25: sparse: sparse: cast from restricted __le16
> >> drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le16 [usertype] raw_data @@     got unsigned short [usertype] __v @@
>    drivers/tty/ipwireless/hardware.c:872:43: sparse:     expected restricted __le16 [usertype] raw_data
> >> drivers/tty/ipwireless/hardware.c:872:43: sparse:     got unsigned short [usertype] __v
>    drivers/tty/ipwireless/hardware.c:889:43: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le16 [usertype] raw_data @@     got unsigned short [usertype] __v @@
>    drivers/tty/ipwireless/hardware.c:889:43: sparse:     expected restricted __le16 [usertype] raw_data
>    drivers/tty/ipwireless/hardware.c:889:43: sparse:     got unsigned short [usertype] __v

I think it's a preexisting bug that we already get a warning for in other
configurations, now the same warning also appears on s3c24xx.

The bug was already in the original merge of the driver:

+               for (i = 0; i < len; i += 2) {
+                       __le16 raw_data = inw(hw->base_port + IODMADPR);
+                       unsigned short data = le16_to_cpu(raw_data);
+
+                       pkt[i] = (unsigned char) data;
+                       pkt[i + 1] = (unsigned char) (data >> 8);
+               }

This reimplements the insw() function with a total of three byte swaps on
big-endian machines. I assume an even number of byte swaps  (as done
by inw) would have been needed to make it work on big-endian, but this
depends on the actual hardware implementation.

It seems unlikely that there are any big-endian machines with pc-card
slots that would want to use this hardware.

       Arnd

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 1797/8629] drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types)
  2020-09-18  8:10 ` Arnd Bergmann
@ 2020-09-18  8:37   ` Krzysztof Kozlowski
  2020-09-18 13:50   ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2020-09-18  8:37 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5941 bytes --]

On Fri, 18 Sep 2020 at 10:11, Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Thu, Sep 17, 2020 at 11:10 PM kernel test robot <lkp@intel.com> wrote:
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   860461e4fcaa76200d2d1a53523e0ff7be92e6e8
> > commit: 98c2922ec8f0601321428be8c59ae1df255478d1 [1797/8629] ARM: s3c24xx: simplify mach/io.h
> > config: arm-randconfig-s031-20200917 (attached as .config)
> > compiler: arm-linux-gnueabi-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.2-201-g24bdaac6-dirty
> >         git checkout 98c2922ec8f0601321428be8c59ae1df255478d1
> >         # 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=arm
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> >
> > sparse warnings: (new ones prefixed by >>)
> >
> >    drivers/tty/ipwireless/hardware.c:431:25: sparse: sparse: cast from restricted __le16
> >    drivers/tty/ipwireless/hardware.c:445:25: sparse: sparse: cast from restricted __le16
> > >> drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le16 [usertype] raw_data @@     got unsigned short [usertype] __v @@
> >    drivers/tty/ipwireless/hardware.c:872:43: sparse:     expected restricted __le16 [usertype] raw_data
> > >> drivers/tty/ipwireless/hardware.c:872:43: sparse:     got unsigned short [usertype] __v
> >    drivers/tty/ipwireless/hardware.c:889:43: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le16 [usertype] raw_data @@     got unsigned short [usertype] __v @@
> >    drivers/tty/ipwireless/hardware.c:889:43: sparse:     expected restricted __le16 [usertype] raw_data
> >    drivers/tty/ipwireless/hardware.c:889:43: sparse:     got unsigned short [usertype] __v
>
> I think it's a preexisting bug that we already get a warning for in other
> configurations, now the same warning also appears on s3c24xx.
>
> The bug was already in the original merge of the driver:
>
> +               for (i = 0; i < len; i += 2) {
> +                       __le16 raw_data = inw(hw->base_port + IODMADPR);
> +                       unsigned short data = le16_to_cpu(raw_data);
> +
> +                       pkt[i] = (unsigned char) data;
> +                       pkt[i + 1] = (unsigned char) (data >> 8);
> +               }
>
> This reimplements the insw() function with a total of three byte swaps on
> big-endian machines. I assume an even number of byte swaps  (as done
> by inw) would have been needed to make it work on big-endian, but this
> depends on the actual hardware implementation.
>
> It seems unlikely that there are any big-endian machines with pc-card
> slots that would want to use this hardware.

Warnings were there before, although in slightly different form.
Before:
../drivers/tty/ipwireless/hardware.c:431:25: warning: incorrect type
in argument 1 (different base types)
../drivers/tty/ipwireless/hardware.c:431:25:    expected unsigned int val
../drivers/tty/ipwireless/hardware.c:431:25:    got restricted __le16
[assigned] [usertype] raw_data
../drivers/tty/ipwireless/hardware.c:431:25: warning: incorrect type
in initializer (different base types)
../drivers/tty/ipwireless/hardware.c:431:25:    expected unsigned long v
../drivers/tty/ipwireless/hardware.c:431:25:    got restricted __le16
[assigned] [usertype] raw_data
../drivers/tty/ipwireless/hardware.c:445:25: warning: incorrect type
in argument 1 (different base types)
../drivers/tty/ipwireless/hardware.c:445:25:    expected unsigned int val
../drivers/tty/ipwireless/hardware.c:445:25:    got restricted __le16
[assigned] [usertype] raw_data
../drivers/tty/ipwireless/hardware.c:445:25: warning: incorrect type
in initializer (different base types)
../drivers/tty/ipwireless/hardware.c:445:25:    expected unsigned long v
../drivers/tty/ipwireless/hardware.c:445:25:    got restricted __le16
[assigned] [usertype] raw_data
../drivers/tty/ipwireless/hardware.c:872:43: warning: incorrect type
in initializer (different base types)
../drivers/tty/ipwireless/hardware.c:872:43:    expected restricted
__le16 [usertype] raw_data
../drivers/tty/ipwireless/hardware.c:872:43:    got int
../drivers/tty/ipwireless/hardware.c:889:43: warning: incorrect type
in initializer (different base types)
../drivers/tty/ipwireless/hardware.c:889:43:    expected restricted
__le16 [usertype] raw_data
../drivers/tty/ipwireless/hardware.c:889:43:    got int

After:
../drivers/tty/ipwireless/hardware.c:431:25: warning: cast from
restricted __le16
../drivers/tty/ipwireless/hardware.c:445:25: warning: cast from
restricted __le16
../drivers/tty/ipwireless/hardware.c:872:43: warning: incorrect type
in initializer (different base types)
../drivers/tty/ipwireless/hardware.c:872:43:    expected restricted
__le16 [usertype] raw_data
../drivers/tty/ipwireless/hardware.c:872:43:    got unsigned short
[usertype] __v
../drivers/tty/ipwireless/hardware.c:889:43: warning: incorrect type
in initializer (different base types)
../drivers/tty/ipwireless/hardware.c:889:43:    expected restricted
__le16 [usertype] raw_data
../drivers/tty/ipwireless/hardware.c:889:43:    got unsigned short
[usertype] __v

The lines 431 and 445 are equivalent. The 872 and 889, look still good
because this is reading a word, so 16 bits size. Before it was int
which looks like a mistake itself in the S3C24xx macros.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [linux-next:master 1797/8629] drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types)
  2020-09-18  8:10 ` Arnd Bergmann
  2020-09-18  8:37   ` Krzysztof Kozlowski
@ 2020-09-18 13:50   ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2020-09-18 13:50 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3434 bytes --]

On Fri, Sep 18, 2020 at 10:10:57AM +0200, Arnd Bergmann wrote:
> On Thu, Sep 17, 2020 at 11:10 PM kernel test robot <lkp@intel.com> wrote:
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   860461e4fcaa76200d2d1a53523e0ff7be92e6e8
> > commit: 98c2922ec8f0601321428be8c59ae1df255478d1 [1797/8629] ARM: s3c24xx: simplify mach/io.h
> > config: arm-randconfig-s031-20200917 (attached as .config)
> > compiler: arm-linux-gnueabi-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.2-201-g24bdaac6-dirty
> >         git checkout 98c2922ec8f0601321428be8c59ae1df255478d1
> >         # 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=arm
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> >
> > sparse warnings: (new ones prefixed by >>)
> >
> >    drivers/tty/ipwireless/hardware.c:431:25: sparse: sparse: cast from restricted __le16
> >    drivers/tty/ipwireless/hardware.c:445:25: sparse: sparse: cast from restricted __le16
> > >> drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le16 [usertype] raw_data @@     got unsigned short [usertype] __v @@
> >    drivers/tty/ipwireless/hardware.c:872:43: sparse:     expected restricted __le16 [usertype] raw_data
> > >> drivers/tty/ipwireless/hardware.c:872:43: sparse:     got unsigned short [usertype] __v
> >    drivers/tty/ipwireless/hardware.c:889:43: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le16 [usertype] raw_data @@     got unsigned short [usertype] __v @@
> >    drivers/tty/ipwireless/hardware.c:889:43: sparse:     expected restricted __le16 [usertype] raw_data
> >    drivers/tty/ipwireless/hardware.c:889:43: sparse:     got unsigned short [usertype] __v
> 
> I think it's a preexisting bug that we already get a warning for in other
> configurations, now the same warning also appears on s3c24xx.
> 
> The bug was already in the original merge of the driver:
> 
> +               for (i = 0; i < len; i += 2) {
> +                       __le16 raw_data = inw(hw->base_port + IODMADPR);
> +                       unsigned short data = le16_to_cpu(raw_data);
> +
> +                       pkt[i] = (unsigned char) data;
> +                       pkt[i + 1] = (unsigned char) (data >> 8);
> +               }
> 
> This reimplements the insw() function with a total of three byte swaps on
> big-endian machines. I assume an even number of byte swaps  (as done
> by inw) would have been needed to make it work on big-endian, but this
> depends on the actual hardware implementation.
> 
> It seems unlikely that there are any big-endian machines with pc-card
> slots that would want to use this hardware.

The IP Wireless hardware is past its best times, we even don't have it
available for testing patches, so I'd rather keep functional changes to
minimum. If the sparse warning bothers somebody too much, add a comment
there.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-18 13:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 21:09 [linux-next:master 1797/8629] drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types) kernel test robot
2020-09-18  8:10 ` Arnd Bergmann
2020-09-18  8:37   ` Krzysztof Kozlowski
2020-09-18 13:50   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.