[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201006183400.GJ4282@kadam>
Date: Tue, 6 Oct 2020 21:34:00 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: kbuild@...ts.01.org, kholk11@...il.com, dmitry.torokhov@...il.com
Cc: lkp@...el.com, kbuild-all@...ts.01.org, robh+dt@...nel.org,
rydberg@...math.org, priv.luk@...il.com,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
kholk11@...il.com, marijns95@...il.com, konradybcio@...il.com,
martin.botka1@...il.com
Subject: Re: [PATCH v2 2/3] Input: Add Novatek NT36xxx touchscreen driver
Hi,
Thank you for the patch! Perhaps something to improve:
url: https://github.com/0day-ci/linux/commits/kholk11-gmail-com/Add-Novatek-NT36xxx-touchscreen-driver/20200927-203756
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: i386-randconfig-m021-20201003 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
smatch warnings:
drivers/input/touchscreen/nt36xxx.c:470 nt36xxx_i2c_chip_version_init() warn: calling memset(x, y, ARRAY_SIZE());
vim +470 drivers/input/touchscreen/nt36xxx.c
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 443 static int nt36xxx_i2c_chip_version_init(struct nt36xxx_i2c *ts)
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 444 {
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 445 u8 buf[7] = { 0 };
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 446 int retry = NT36XXX_MAX_RETRIES;
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 447 int sz = sizeof(trim_id_table) / sizeof(struct nt36xxx_trim_table);
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 448 int i, list, mapid, ret;
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 449
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 450 ret = nt36xxx_bootloader_reset(ts);
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 451 if (ret < 0) {
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 452 dev_err(&ts->client->dev, "Can't reset the nvt IC\n");
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 453 return ret;
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 454 }
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 455
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 456 do {
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 457 ret = nt36xxx_sw_reset_idle(ts);
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 458 if (ret < 0)
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 459 continue;
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 460
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 461 buf[0] = 0x00;
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 462 buf[1] = NT36XXX_CMD_UNLOCK;
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 463 nt36xxx_write(ts->client, ts->client->addr, buf, 2);
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 464 usleep_range(10000, 11000);
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 465
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 466 ret = nt36xxx_set_page(ts, NT36XXX_PAGE_CHIP_INFO);
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 467 if (ret < 0)
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 468 continue;
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 469
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 @470 memset(buf, 0, ARRAY_SIZE(buf));
memset() should always zero the number of bytes (sizeof(buf)), not the
number of elements (ARRAY_SIZE(buf)). For u8, of course, the elements
are byte size so it's the same. But if someone uses
`grep -w memset $(git ls-files) | grep ARRAY_SIZE` then this will show
up as improper code.
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 471 buf[0] = NT36XXX_EVT_CHIPID;
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 472 nt36xxx_read(ts->client, NT36XXX_BLDR_ADDR, buf, 7);
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 473
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 474 /* Compare read chip id with trim list */
6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 475 for (list = 0; list < sz; list++) {
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (31853 bytes)
Powered by blists - more mailing lists