drivers/tty/mips_ejtag_fdc.c:343:32: error: incompatible pointer types passing 'const char **' to parameter of type 'const u8 **' (aka 'const unsigned char **')

From: kernel test robot
Date: Wed Sep 11 2024 - 02:34:56 EST


Hi Jiri,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8d8d276ba2fb5f9ac4984f5c10ae60858090babc
commit: ce7cbd9a6c81b5fc899bbc730072a1bddeae5d0d tty: mips_ejtag_fdc: use u8 for character pointers
date: 9 months ago
config: mips-randconfig-r051-20240911 (https://download.01.org/0day-ci/archive/20240911/202409111435.RTzhB8Te-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240911/202409111435.RTzhB8Te-lkp@xxxxxxxxx/reproduce)

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409111435.RTzhB8Te-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> drivers/tty/mips_ejtag_fdc.c:343:32: error: incompatible pointer types passing 'const char **' to parameter of type 'const u8 **' (aka 'const unsigned char **') [-Werror,-Wincompatible-pointer-types]
word = mips_ejtag_fdc_encode(&buf_ptr, &buf_len, 1);
^~~~~~~~
drivers/tty/mips_ejtag_fdc.c:216:57: note: passing argument to parameter 'ptrs' here
static struct fdc_word mips_ejtag_fdc_encode(const u8 **ptrs,
^
drivers/tty/mips_ejtag_fdc.c:1224:31: error: incompatible pointer types passing 'const char *[1]' to parameter of type 'const u8 **' (aka 'const unsigned char **') [-Werror,-Wincompatible-pointer-types]
word = mips_ejtag_fdc_encode(bufs, &kgdbfdc_wbuflen, 1);
^~~~
drivers/tty/mips_ejtag_fdc.c:216:57: note: passing argument to parameter 'ptrs' here
static struct fdc_word mips_ejtag_fdc_encode(const u8 **ptrs,
^
2 errors generated.


vim +343 drivers/tty/mips_ejtag_fdc.c

4cebec609aea6df James Hogan 2015-01-29 299
4cebec609aea6df James Hogan 2015-01-29 300 /* Low level console write shared by early console and normal console */
4cebec609aea6df James Hogan 2015-01-29 301 static void mips_ejtag_fdc_console_write(struct console *c, const char *s,
4cebec609aea6df James Hogan 2015-01-29 302 unsigned int count)
4cebec609aea6df James Hogan 2015-01-29 303 {
4cebec609aea6df James Hogan 2015-01-29 304 struct mips_ejtag_fdc_console *cons =
4cebec609aea6df James Hogan 2015-01-29 305 container_of(c, struct mips_ejtag_fdc_console, cons);
4cebec609aea6df James Hogan 2015-01-29 306 void __iomem *regs;
4cebec609aea6df James Hogan 2015-01-29 307 struct fdc_word word;
4cebec609aea6df James Hogan 2015-01-29 308 unsigned long flags;
4cebec609aea6df James Hogan 2015-01-29 309 unsigned int i, buf_len, cpu;
4cebec609aea6df James Hogan 2015-01-29 310 bool done_cr = false;
4cebec609aea6df James Hogan 2015-01-29 311 char buf[4];
4cebec609aea6df James Hogan 2015-01-29 312 const char *buf_ptr = buf;
4cebec609aea6df James Hogan 2015-01-29 313 /* Number of bytes of input data encoded up to each byte in buf */
4cebec609aea6df James Hogan 2015-01-29 314 u8 inc[4];
4cebec609aea6df James Hogan 2015-01-29 315
4cebec609aea6df James Hogan 2015-01-29 316 local_irq_save(flags);
4cebec609aea6df James Hogan 2015-01-29 317 cpu = smp_processor_id();
4cebec609aea6df James Hogan 2015-01-29 318 regs = cons->regs[cpu];
4cebec609aea6df James Hogan 2015-01-29 319 /* First console output on this CPU? */
4cebec609aea6df James Hogan 2015-01-29 320 if (!regs) {
4cebec609aea6df James Hogan 2015-01-29 321 regs = mips_cdmm_early_probe(0xfd);
4cebec609aea6df James Hogan 2015-01-29 322 cons->regs[cpu] = regs;
4cebec609aea6df James Hogan 2015-01-29 323 }
4cebec609aea6df James Hogan 2015-01-29 324 /* Already tried and failed to find FDC on this CPU? */
4cebec609aea6df James Hogan 2015-01-29 325 if (IS_ERR(regs))
4cebec609aea6df James Hogan 2015-01-29 326 goto out;
4cebec609aea6df James Hogan 2015-01-29 327 while (count) {
4cebec609aea6df James Hogan 2015-01-29 328 /*
4cebec609aea6df James Hogan 2015-01-29 329 * Copy the next few characters to a buffer so we can inject
4cebec609aea6df James Hogan 2015-01-29 330 * carriage returns before newlines.
4cebec609aea6df James Hogan 2015-01-29 331 */
4cebec609aea6df James Hogan 2015-01-29 332 for (buf_len = 0, i = 0; buf_len < 4 && i < count; ++buf_len) {
4cebec609aea6df James Hogan 2015-01-29 333 if (s[i] == '\n' && !done_cr) {
4cebec609aea6df James Hogan 2015-01-29 334 buf[buf_len] = '\r';
4cebec609aea6df James Hogan 2015-01-29 335 done_cr = true;
4cebec609aea6df James Hogan 2015-01-29 336 } else {
4cebec609aea6df James Hogan 2015-01-29 337 buf[buf_len] = s[i];
4cebec609aea6df James Hogan 2015-01-29 338 done_cr = false;
4cebec609aea6df James Hogan 2015-01-29 339 ++i;
4cebec609aea6df James Hogan 2015-01-29 340 }
4cebec609aea6df James Hogan 2015-01-29 341 inc[buf_len] = i;
4cebec609aea6df James Hogan 2015-01-29 342 }
4cebec609aea6df James Hogan 2015-01-29 @343 word = mips_ejtag_fdc_encode(&buf_ptr, &buf_len, 1);
4cebec609aea6df James Hogan 2015-01-29 344 count -= inc[word.bytes - 1];
4cebec609aea6df James Hogan 2015-01-29 345 s += inc[word.bytes - 1];
4cebec609aea6df James Hogan 2015-01-29 346
4cebec609aea6df James Hogan 2015-01-29 347 /* Busy wait until there's space in fifo */
70f041b6e1ff508 James Hogan 2015-04-28 348 while (__raw_readl(regs + REG_FDSTAT) & REG_FDSTAT_TXF)
4cebec609aea6df James Hogan 2015-01-29 349 ;
70f041b6e1ff508 James Hogan 2015-04-28 350 __raw_writel(word.word, regs + REG_FDTX(c->index));
4cebec609aea6df James Hogan 2015-01-29 351 }
4cebec609aea6df James Hogan 2015-01-29 352 out:
4cebec609aea6df James Hogan 2015-01-29 353 local_irq_restore(flags);
4cebec609aea6df James Hogan 2015-01-29 354 }
4cebec609aea6df James Hogan 2015-01-29 355

:::::: The code at line 343 was first introduced by commit
:::::: 4cebec609aea6dff23e67a42b6516d852fa87d07 TTY: Add MIPS EJTAG Fast Debug Channel TTY driver

:::::: TO: James Hogan <james.hogan@xxxxxxxxxx>
:::::: CC: Ralf Baechle <ralf@xxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki