Re: [PATCH v5 3/5] media: i2c: add driver for the SK Hynix Hi-846 8M pixel camera

From: kernel test robot
Date: Fri Jun 18 2021 - 05:35:04 EST


Hi Martin,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20210617]
[cannot apply to robh/for-next arm64/for-next/core linus/master v5.13-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Martin-Kepplinger/Add-support-for-the-Hynix-Hi-846-camera/20210616-213802
base: git://linuxtv.org/media_tree.git master
config: powerpc64-randconfig-r002-20210618 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 64720f57bea6a6bf033feef4a5751ab9c0c3b401)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://github.com/0day-ci/linux/commit/a6a93a98f579077a210a432a360082e4382f531a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Martin-Kepplinger/Add-support-for-the-Hynix-Hi-846-camera/20210616-213802
git checkout a6a93a98f579077a210a432a360082e4382f531a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64

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

All error/warnings (new ones prefixed by >>):

In file included from drivers/media/i2c/hi846.c:13:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:182:1: note: expanded from here
__do_insl
^
arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
#define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/media/i2c/hi846.c:13:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:184:1: note: expanded from here
__do_outsb
^
arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
#define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/media/i2c/hi846.c:13:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:186:1: note: expanded from here
__do_outsw
^
arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
#define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/media/i2c/hi846.c:13:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:188:1: note: expanded from here
__do_outsl
^
arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
>> drivers/media/i2c/hi846.c:1489:2: warning: comparison of distinct pointer types ('typeof ((link_freq)) *' (aka 'long long *') and 'uint64_t *' (aka 'unsigned long long *')) [-Wcompare-distinct-pointer-types]
do_div(link_freq, fps);
^~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:228:28: note: expanded from macro 'do_div'
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
>> drivers/media/i2c/hi846.c:1491:2: warning: comparison of distinct pointer types ('typeof ((frame_length)) *' (aka 'int *') and 'uint64_t *' (aka 'unsigned long long *')) [-Wcompare-distinct-pointer-types]
do_div(frame_length, HI846_LINE_LENGTH);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:228:28: note: expanded from macro 'do_div'
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
>> drivers/media/i2c/hi846.c:1491:2: error: incompatible pointer types passing 'int *' to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
do_div(frame_length, HI846_LINE_LENGTH);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:245:22: note: expanded from macro 'do_div'
__rem = __div64_32(&(n), __base); \
^~~~
include/asm-generic/div64.h:219:38: note: passing argument to parameter 'dividend' here
extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
^
>> drivers/media/i2c/hi846.c:1491:2: warning: shift count >= width of type [-Wshift-count-overflow]
do_div(frame_length, HI846_LINE_LENGTH);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:241:25: note: expanded from macro 'do_div'
} else if (likely(((n) >> 32) == 0)) { \
^ ~~
include/linux/compiler.h:77:40: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
>> drivers/media/i2c/hi846.c:1529:26: warning: address of 'hi846->cur_mode->reg_list_2lane' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (!&hi846->cur_mode->reg_list_2lane) {
~ ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
>> drivers/media/i2c/hi846.c:1535:26: warning: address of 'hi846->cur_mode->reg_list_4lane' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (!&hi846->cur_mode->reg_list_4lane) {
~ ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
12 warnings and 1 error generated.


vim +1491 drivers/media/i2c/hi846.c

1477
1478 static int hi846_set_video_mode(struct hi846 *hi846, int fps)
1479 {
1480 struct i2c_client *client = v4l2_get_subdevdata(&hi846->sd);
1481 int frame_length;
1482 int ret = 0;
1483 int dummy_lines;
1484 s64 link_freq = hi846_get_link_freq(hi846);
1485
1486 dev_dbg(&client->dev, "%s: link freq: %lld\n", __func__,
1487 hi846_get_link_freq(hi846));
1488
> 1489 do_div(link_freq, fps);
1490 frame_length = link_freq;
> 1491 do_div(frame_length, HI846_LINE_LENGTH);
1492
1493 dummy_lines = (frame_length > hi846->cur_mode->frame_len) ?
1494 (frame_length - hi846->cur_mode->frame_len) : 0;
1495
1496 frame_length = hi846->cur_mode->frame_len + dummy_lines;
1497
1498 dev_dbg(&client->dev, "%s: frame length calculated: %d\n", __func__,
1499 frame_length);
1500
1501 hi846_write_reg_16(hi846, HI846_REG_FLL, frame_length & 0xFFFF, &ret);
1502 hi846_write_reg_16(hi846, HI846_REG_LLP, HI846_LINE_LENGTH & 0xFFFF, &ret);
1503
1504 return ret;
1505 }
1506
1507 static int hi846_start_streaming(struct hi846 *hi846)
1508 {
1509 struct i2c_client *client = v4l2_get_subdevdata(&hi846->sd);
1510 int ret = 0;
1511 u8 val;
1512
1513 if (hi846->nr_lanes == 2)
1514 ret = hi846_write_reg_list(hi846, &hi846_init_regs_list_2lane);
1515 else
1516 ret = hi846_write_reg_list(hi846, &hi846_init_regs_list_4lane);
1517 if (ret) {
1518 dev_err(&client->dev, "failed to set plls: %d\n", ret);
1519 return ret;
1520 }
1521
1522 ret = hi846_write_reg_list(hi846, &hi846->cur_mode->reg_list_config);
1523 if (ret) {
1524 dev_err(&client->dev, "failed to set mode: %d\n", ret);
1525 return ret;
1526 }
1527
1528 if (hi846->nr_lanes == 2) {
> 1529 if (!&hi846->cur_mode->reg_list_2lane) {
1530 dev_err(&client->dev, "2 lanes unsupported for this mode\n");
1531 return -EINVAL;
1532 }
1533 ret = hi846_write_reg_list(hi846, &hi846->cur_mode->reg_list_2lane);
1534 } else {
> 1535 if (!&hi846->cur_mode->reg_list_4lane) {
1536 dev_err(&client->dev, "4 lanes unsupported for this mode\n");
1537 return -EINVAL;
1538 }
1539 ret = hi846_write_reg_list(hi846, &hi846->cur_mode->reg_list_4lane);
1540 }
1541 if (ret) {
1542 dev_err(&client->dev, "failed to set mipi mode: %d\n", ret);
1543 return ret;
1544 }
1545
1546 hi846_set_video_mode(hi846, hi846->cur_mode->fps);
1547
1548 ret = __v4l2_ctrl_handler_setup(hi846->sd.ctrl_handler);
1549 if (ret)
1550 return ret;
1551
1552 /*
1553 * Reading 0x0034 is purely done for debugging reasons: It is not
1554 * documented in the DS but only mentioned once:
1555 * "If 0x0034[2] bit is disabled , Visible pixel width and height is 0."
1556 * So even though that sounds like we won't see anything, we don't
1557 * know more about this, so in that case only inform the user but do
1558 * nothing more.
1559 */
1560 ret = hi846_read_reg(hi846, 0x0034, &val);
1561 if (ret)
1562 return ret;
1563 if (!(val & BIT(2)))
1564 dev_info(&client->dev, "visible pixel width and height is 0\n");
1565
1566 ret = hi846_write_reg(hi846, HI846_REG_MODE_SELECT,
1567 HI846_MODE_STREAMING);
1568 if (ret) {
1569 dev_err(&client->dev, "failed to start stream");
1570 return ret;
1571 }
1572
1573 hi846->streaming = 1;
1574
1575 dev_dbg(&client->dev, "%s: started streaming successfully\n", __func__);
1576
1577 return ret;
1578 }
1579

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

Attachment: .config.gz
Description: application/gzip