linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, kholk11@gmail.com, dmitry.torokhov@gmail.com
Cc: lkp@intel.com, kbuild-all@lists.01.org, robh+dt@kernel.org,
	rydberg@bitmath.org, priv.luk@gmail.com,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	kholk11@gmail.com, marijns95@gmail.com, konradybcio@gmail.com,
	martin.botka1@gmail.com
Subject: Re: [PATCH v2 2/3] Input: Add Novatek NT36xxx touchscreen driver
Date: Tue, 6 Oct 2020 21:34:00 +0300	[thread overview]
Message-ID: <20201006183400.GJ4282@kadam> (raw)
In-Reply-To: <20200927123542.553852-3-kholk11@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3921 bytes --]

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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31853 bytes --]

  parent reply	other threads:[~2020-10-06 18:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 12:35 [PATCH v2 0/3] Add Novatek NT36xxx touchscreen driver kholk11
2020-09-27 12:35 ` [PATCH v2 1/3] dt-bindings: Add vendor prefix for Novatek Microelectronics Corp kholk11
2020-09-27 12:35 ` [PATCH v2 2/3] Input: Add Novatek NT36xxx touchscreen driver kholk11
2020-09-28  9:48   ` Amit Pundir
2020-09-28 21:51     ` Dmitry Torokhov
2020-09-29  7:58       ` Amit Pundir
2020-09-28 22:16   ` Dmitry Torokhov
2020-10-06 18:34   ` Dan Carpenter [this message]
2020-09-27 12:35 ` [PATCH v2 3/3] dt-bindings: touchscreen: Add binding for Novatek NT36xxx series driver kholk11

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=20201006183400.GJ4282@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=kholk11@gmail.com \
    --cc=konradybcio@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=marijns95@gmail.com \
    --cc=martin.botka1@gmail.com \
    --cc=priv.luk@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=rydberg@bitmath.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).