Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: nina_kuo@novatek.com.tw
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v8 2/3] i2c: nt72676: Add Novatek NT72676 I2C controller driver
Date: Wed, 02 Sep 2026 09:29:04 +0000	[thread overview]
Message-ID: <20260902092905.2DAAF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902091318.208074-3-nina_kuo@novatek.com.tw>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The driver unconditionally logs a hard error via `dev_err` on I2C NACK, which causes kernel log spam during normal bus probing.
- [Low] Accessing uninitialized i2c->adapter.name in nvt_i2c_init() error path.
--

commit ad108b18a20082d1ab2afdd3a9f9c59f5896754b
Author: Ben Huang <Ben_Huang@novatek.com.tw>

i2c: nt72676: Add Novatek NT72676 I2C controller driver

This commit introduces the driver for the Novatek NT72676 I2C controller,
supporting fundamental read/write functions and both Standard-mode and 
Fast-mode operations.

> diff --git a/drivers/i2c/busses/i2c-nt72676.c b/drivers/i2c/busses/i2c-nt72676.c
> new file mode 100644
> index 0000000000000..ab7be28615f0f
> --- /dev/null
> +++ b/drivers/i2c/busses/i2c-nt72676.c
[ ... ]
> +static int nvt_i2c_init(struct nvt_i2c_bus *i2c)
> +{
> +	if (i2c->comp_data->stbc_i2c) {
> +		int ret = nvt_i2c_stbc_auth(i2c);
> +
> +		if (ret) {
> +			dev_err(i2c->dev, "[%s] STBC authentication failed, ret = %d\n",
> +				i2c->adapter.name, ret);

[Severity: Low]
Does this log an empty string for the adapter name? 

Looking at nvt_i2c_probe(), nvt_i2c_init() is called before the adapter name 
is initialized, meaning this early error path accesses an empty string:

nvt_i2c_probe() {
    ...
    ret = nvt_i2c_init(i2c);
    ...
    strscpy(i2c->adapter.name, dev_name(&pdev->dev), sizeof(i2c->adapter.name));
    ...
}

[ ... ]
> +static int nvt_i2c_write(struct nvt_i2c_bus *i2c, struct i2c_msg *msg)
> +{
[ ... ]
> +	ret = wait_for_completion_timeout(&i2c->msg_complete, i2c->adapter.timeout);
> +
> +	spin_lock_irqsave(&i2c->lock, flags);
> +	if (!ret)
> +		i2c->error_code = -ETIMEDOUT;
> +	nvt_i2c_reset(i2c);
> +	ret = i2c->error_code;
> +	i2c->current_msg = NULL;
> +	spin_unlock_irqrestore(&i2c->lock, flags);
> +
> +	if (ret)
> +		dev_err(i2c->dev, "[%s]: write failed (err:%d); SA[0x%X]\n",
> +			i2c->adapter.name, i2c->error_code, msg->addr);

[Severity: Medium]
Will this spam the kernel ring buffer during normal bus scanning?

Tools like i2cdetect deliberately scan the bus by sending messages to all 
possible addresses. This generates expected NACKs (-ENXIO) for unpopulated 
addresses. 

If we unconditionally log a hard error via dev_err() on NACKs, the kernel 
log can easily get flooded. Could we omit this log or use dev_dbg() instead?

[ ... ]
> +static int nvt_i2c_read(struct nvt_i2c_bus *i2c, struct i2c_msg *msg)
> +{
[ ... ]
> +	ret = wait_for_completion_timeout(&i2c->msg_complete, i2c->adapter.timeout);
> +
> +	spin_lock_irqsave(&i2c->lock, flags);
> +	if (!ret)
> +		i2c->error_code = -ETIMEDOUT;
> +	nvt_i2c_reset(i2c);
> +	ret = i2c->error_code;
> +	i2c->current_msg = NULL;
> +	spin_unlock_irqrestore(&i2c->lock, flags);
> +
> +	if (ret)
> +		dev_err(i2c->dev, "[%s]: read failed (err:%d); SA[0x%X]\n",
> +			i2c->adapter.name, i2c->error_code, msg->addr);

[Severity: Medium]
Similarly, does this also cause unnecessary log spam when a NACK occurs 
during an expected I2C read failure?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260902091318.208074-1-nina_kuo@novatek.com.tw?part=2

  reply	other threads:[~2026-09-02  9:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  9:13 [PATCH v8 0/3] i2c: Add Novatek NT72676 SoC I2C controller nina_kuo
2026-09-02  9:13 ` [PATCH v8 1/3] dt-bindings: i2c: Add Novatek NT72676 " nina_kuo
2026-09-03 16:04   ` Rob Herring
2026-09-04  5:40     ` nina_kuo
2026-09-02  9:13 ` [PATCH v8 2/3] i2c: nt72676: Add Novatek NT72676 I2C controller driver nina_kuo
2026-09-02  9:29   ` sashiko-bot [this message]
2026-09-02  9:13 ` [PATCH v8 3/3] MAINTAINERS: Add entry for " nina_kuo

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=20260902092905.2DAAF1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=nina_kuo@novatek.com.tw \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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