Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chaitanya Sabnis" <chaitanya.msabnis@gmail.com>
Cc: krzk+dt@kernel.org, conor+dt@kernel.org, robh@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v4] dt-bindings: i2c: convert davinci i2c to dt-schema
Date: Thu, 14 May 2026 04:47:25 +0000	[thread overview]
Message-ID: <20260514044726.57297C2BCB7@smtp.kernel.org> (raw)
In-Reply-To: <20260513123758.4955-1-chaitanya.msabnis@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Omitting the 'clock-frequency' property from the device tree causes a deterministic division-by-zero crash in the driver.
--

commit 75f02e0195256a57df4b6d329b0206def30928b6
Author: Chaitanya Sabnis <chaitanya.msabnis@gmail.com>

dt-bindings: i2c: convert davinci i2c to dt-schema

This commit converts the Texas Instruments DaVinci and Keystone I2C
controller bindings from legacy text format to modern dt-schema (YAML).
It also makes the interrupts property required and adds definitions for
SoC-specific hardware features.

> diff --git a/Documentation/devicetree/bindings/i2c/ti,davinci-i2c.yaml b/Documentation/devicetree/bindings/i2c/ti,davinci-i2c.yaml
> new file mode 100644
> index 0000000000000..dd7a7ffa02d54
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/ti,davinci-i2c.yaml

[ ... ]

> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - clocks

Should clock-frequency be included in the required list here?

Omitting the clock-frequency property from the device tree causes a
regression resulting in a division-by-zero crash in the driver.

When clock-frequency is omitted, davinci_i2c_probe() falls back to
DAVINCI_I2C_DEFAULT_BUS_FREQ (100) and calculates dev->bus_freq:

drivers/i2c/busses/i2c-davinci.c:davinci_i2c_probe() {
    ...
    dev->bus_freq = prop / 1000;
    ...
}

Due to integer truncation, dev->bus_freq becomes 0. The driver then calls
i2c_davinci_calc_clk_dividers(), which divides by dev->bus_freq:

drivers/i2c/busses/i2c-davinci.c:i2c_davinci_calc_clk_dividers() {
    ...
    clk = ((input_clock / (psc + 1)) / (dev->bus_freq * 1000));
    ...
}

This executes a division by zero during device probe. Either the C driver's
fallback logic must be corrected, or clock-frequency must be explicitly
required in the schema to prevent this regression.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260513123758.4955-1-chaitanya.msabnis@gmail.com?part=1

      parent reply	other threads:[~2026-05-14  4:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 12:37 [PATCH v4] dt-bindings: i2c: convert davinci i2c to dt-schema Chaitanya Sabnis
2026-05-13 13:37 ` Bartosz Golaszewski
2026-05-13 22:02 ` Andi Shyti
2026-05-14  4:47 ` sashiko-bot [this message]

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=20260514044726.57297C2BCB7@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=chaitanya.msabnis@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --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