drivers/tty/serial/cpm_uart/cpm_uart_core.c:1052:13: sparse: sparse: incorrect type in assignment (different address spaces)

From: kernel test robot
Date: Wed Aug 25 2021 - 13:48:02 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6e764bcd1cf72a2846c0e53d3975a09b242c04c9
commit: 6895c5ba7bdcc55eacad03cf309ab23be63b9cac powerpc/xmon: Select CONSOLE_POLL for the 8xx
date: 7 months ago
config: powerpc-randconfig-s032-20210825 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 11.2.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-348-gf0e6938b-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6895c5ba7bdcc55eacad03cf309ab23be63b9cac
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 6895c5ba7bdcc55eacad03cf309ab23be63b9cac
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc

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/tty/serial/cpm_uart/cpm_uart_core.c:1052:13: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct cpm_buf_desc volatile [usertype] *bdp @@ got struct cpm_buf_desc [noderef] [usertype] __iomem *rx_cur @@
drivers/tty/serial/cpm_uart/cpm_uart_core.c:1052:13: sparse: expected struct cpm_buf_desc volatile [usertype] *bdp
drivers/tty/serial/cpm_uart/cpm_uart_core.c:1052:13: sparse: got struct cpm_buf_desc [noderef] [usertype] __iomem *rx_cur
drivers/tty/serial/cpm_uart/cpm_uart_core.c:1071:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct cpm_buf_desc volatile [usertype] *bdp @@ got struct cpm_buf_desc [noderef] [usertype] __iomem *rx_bd_base @@
drivers/tty/serial/cpm_uart/cpm_uart_core.c:1071:21: sparse: expected struct cpm_buf_desc volatile [usertype] *bdp
drivers/tty/serial/cpm_uart/cpm_uart_core.c:1071:21: sparse: got struct cpm_buf_desc [noderef] [usertype] __iomem *rx_bd_base
>> drivers/tty/serial/cpm_uart/cpm_uart_core.c:1074:23: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct cpm_buf_desc [noderef] [usertype] __iomem *rx_cur @@ got struct cpm_buf_desc [usertype] * @@
drivers/tty/serial/cpm_uart/cpm_uart_core.c:1074:23: sparse: expected struct cpm_buf_desc [noderef] [usertype] __iomem *rx_cur
drivers/tty/serial/cpm_uart/cpm_uart_core.c:1074:23: sparse: got struct cpm_buf_desc [usertype] *
drivers/tty/serial/cpm_uart/cpm_uart_core.c:1279:39: sparse: sparse: context imbalance in 'cpm_uart_console_write' - unexpected unlock

vim +1052 drivers/tty/serial/cpm_uart/cpm_uart_core.c

8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1043
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1044 static int poll_wait_key(char *obuf, struct uart_cpm_port *pinfo)
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1045 {
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1046 u_char c, *cp;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1047 volatile cbd_t *bdp;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1048 int i;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1049
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1050 /* Get the address of the host memory buffer.
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1051 */
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 @1052 bdp = pinfo->rx_cur;
be28c1e3ca2988 drivers/tty/serial/cpm_uart/cpm_uart_core.c Christophe Leroy 2018-09-14 1053 if (bdp->cbd_sc & BD_SC_EMPTY)
be28c1e3ca2988 drivers/tty/serial/cpm_uart/cpm_uart_core.c Christophe Leroy 2018-09-14 1054 return NO_POLL_CHAR;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1055
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1056 /* If the buffer address is in the CPM DPRAM, don't
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1057 * convert it.
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1058 */
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1059 cp = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo);
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1060
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1061 if (obuf) {
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1062 i = c = bdp->cbd_datlen;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1063 while (i-- > 0)
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1064 *obuf++ = *cp++;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1065 } else
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1066 c = *cp;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1067 bdp->cbd_sc &= ~(BD_SC_BR | BD_SC_FR | BD_SC_PR | BD_SC_OV | BD_SC_ID);
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1068 bdp->cbd_sc |= BD_SC_EMPTY;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1069
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1070 if (bdp->cbd_sc & BD_SC_WRAP)
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1071 bdp = pinfo->rx_bd_base;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1072 else
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1073 bdp++;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 @1074 pinfo->rx_cur = (cbd_t *)bdp;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1075
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1076 return (int)c;
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1077 }
8e21d04c077c50 drivers/serial/cpm_uart/cpm_uart_core.c Jason Wessel 2008-07-23 1078

:::::: The code at line 1052 was first introduced by commit
:::::: 8e21d04c077c50284bdad10fda8f8cea674458e1 kgdb: kgdboc console poll hooks for cpm uart

:::::: TO: Jason Wessel <jason.wessel@xxxxxxxxxxxxx>
:::::: CC: Jason Wessel <jason.wessel@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip