All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: kbuild-all@lists.01.org
Subject: Re: [linux-next:master 1797/8629] drivers/tty/ipwireless/hardware.c:872:43: sparse: sparse: incorrect type in initializer (different base types)
Date: Fri, 18 Sep 2020 10:10:57 +0200	[thread overview]
Message-ID: <CAK8P3a3s7Z13QEb+r_cC-i9jOoPGfq70OK1Atr4oc6L6tPPd0A@mail.gmail.com> (raw)
In-Reply-To: <202009180519.JLGQxdES%lkp@intel.com>

[-- 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

  reply	other threads:[~2020-09-18  8:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-09-18  8:37   ` Krzysztof Kozlowski
2020-09-18 13:50   ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK8P3a3s7Z13QEb+r_cC-i9jOoPGfq70OK1Atr4oc6L6tPPd0A@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.